Developer forum

Forum » Ecommerce - Standard features » Show products in stock in the begining of the list

Show products in stock in the begining of the list

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a request from a customer to always display out of stock products at the end of the list.

What is the best option to achieve this? Can it be accomplished with some boosting on one of the fields? Is there any other/better alternative?

Thank you,
Adrian


Replies

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Adrian,

 

What if you create a field of type "Grouping" that if stock is equal or lower to 0, you assing a value of 100, and then if it's higher than 0 you assign 1. You can then use that field for sorting.

 

Best Regards,

Nuno Aguiar

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Me again.

I have made a test with a grouping field (named it Availability), setting 0 for any stock between -1000 and 0 and 1 for anything higher than 1.

If I set the Availability as a sorting criterion in the query or in the ProductCatalog app, nothing happens. If I add it as a parameter in the URL (&SortBy=Availability), the sorting is done nicely.

It looks like a bug unless I am missing something.

I am using DW 9.7.3.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nuno,

Great minds think alike :)

I have already tried it but apparently the sorting parameters from query or from ProductApp are not making it to the actual logic.

I have tried it manually in the URL and it works with the grouping field. But the Feed is not receiving the sorting information.

I have tried with Int32 grouping field and also with a string grouping field. No luck.

Adrian

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

smiley Great minds think alike 

 

Sorry to hear it does not work. You could try to set that as an IndexBuilderExtender instead of a grouping field (although it should not matter)

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

It won't matter. If it works in the URL, it means the field is fine.

Passing the criteria to the feed seems to be the problem.

Let's wait for DW's response.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Bump!

 

You must be logged in to post in the forum