Developer forum

Forum » Ecommerce - Standard features » Sorting products

Sorting products

Ricardo Pereira
Reply

Hi guys,

I'm listing products with the new "index" but I can not sort them by the module or parameter (sortby/SortOrder).
Is this a DW bug or I have to configure something else?

DW Version: 8.6.1.14

 

Best Regards,

Ricardo Pereira

 

 


Replies

 
Nuno Aguiar
Reply

Hi,

 

Does anyone have an answer for this? We are using the new index engine but need to control the sorting in frontend.

 

Best Regards,

Nuno Aguiar

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Ricardo,

There are a couple of ways you can specify sorting. If you want static sorting, you can set that on the query. Dynamic sorting, i.e., sorting specified in the frontend, is handled a bit differently. You need to create a parameter on the query with the same name as the field you want to sort by, then you can pass SortBy and SortDirection in the query string, and the sorting will be applied.

Be aware, that we fixed this so it doesn't require a parameter with the same name as the field in Dynamicweb 8.7.

- Jeppe

 
Ricardo Pereira
Reply

Hi Jeppe,

I created the paramaters "SortBy" and "SortOrder" but I have not the sorting anyway.
Example: "?SortBy=Name&SortOrder=ASC"

Best Regards,

Ricardo Pereira

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply
This post has been marked as an answer

Hi Ricardo,

You need to create a parameter with the same name as the field. In your case, you need to create a parameter called "Name".

- Jeppe

Votes for this answer: 1
 
Ricardo Pereira
Reply

Works!! Thank you Jeppe. 

 

You must be logged in to post in the forum