Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Sorting product by availability
Hi all, is there a way to sort products by availability in a search result widget using the sort widget?
Hi Gennaro, I haven't worked with Commerce very much, but you can try to find sortbale fields and add the Sort to the Search > Sort widget. So, is "availability" an indexed field? If it is, and if its data type is sortable (see the linked documentation), you can add a sort option (see the same linked documentation).
But there's also a Commerce > Sort widget. I don't know anything about it, but maybe it supports your use case.
Hi Russell, yes I saw that and already tried to find some fields. Actually I found 2 of them that I thought may work (itemsQuantity and quantity). But when I use them to sort my list all the products disappears.
I also tried the Commerce > Sort widget, but it seems not configurable.
So I added a couple of products, and I don't see that they have quantity, or availability, or any similar fields indexed in the returned document. You can see this if you enable "Show Results in Document Form" in the Search Results widget.
Powered by Liferay™