Developer forum

Forum » Ecommerce - Standard features » Product sorting with 2 parameters

Product sorting with 2 parameters

Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

We have requirement to order product list with 2 parameters.

standed order from name,price or top selling and result from this list order base on stock availability as fixed always.

is there any method to achive this from configuration?

 


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Shiwanka,

 

You can configure the normal sorting by 2 parameters in the Query https://doc.dynamicweb.com/documentation-9/repositories/indexing/queries#sideNavTitle1-4, but once you want multiple options for the user to choose from, where at least a single option contains more than one, you may have to customize it.

 

Here's a site with the sorting https://www.biolegend.com/en-us/search-results?Keywords=cd24. By changing the sorting you'll see that a queryparameter SortBy is populated with comma split values of the system names to sort them by.

 

Hope this helps,

Nuno Aguiar

 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Hi Nuno

Thanks for the reply.

can i achive this scenario >>  Name sort by ASC and stock always DESC

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply
This post has been marked as an answer

Hi Shiwanka,

 

I believe you can. You have to use the SortOrder parameter in order.
i.e. &SortBy=Name,Stock&SortOrder=ASC,DESC

 

I haven't done this in a while, but give it a try

 

Best Regards,

Nuno

Votes for this answer: 1
 
Shiwanka Chathuranga Dynamicweb Employee
Shiwanka Chathuranga
Reply

Thanks Nuno for the help and it work with slight changes.

i have to use new field for stock like if stock is > 0 then new field will be 1 and if stock is <=0 new field will be 2. (kind of 2 grouping )

then using this new field always at the ASC order and also that as first parameter in sorting.

chears....

 

You must be logged in to post in the forum