Hi,
I have used this post to displayin stock product variants first, and it’s works great :
When viewing the product page of a matrix item (for example, clothing), by default the first member of a dimension is displayed first. If this variant is not in stock, an out-of-stock message is displayed. Using field mappings, you can set up your product pages to instead display the first size in stock.
To apply a field mapping to cause in-stock items to be displayed before out-of-stock items in matrix drop-down lists, perform the following steps:
In NSc Sync Configuration, under Advanced, se…
But now i’m wondering if i can sort in my products listing, the products in-stock first by default.
I tried adding the sort filter in the “product listing” template, but it does not work.
Has anyone ever done that?
Regards,
Damien
donogh
October 13, 2017, 3:44pm
2
Hi Damien,
This could be done using the product_priority field, or the Priority field in PAM if you wanted to manually sort by in-stock.
The essential idea is to set the field to ‘1’ if the item is in stock, or 0 if it’s not. Items with a higher priority number rank higher on the listing pages.
Given that you’re using matrix items, we first need to determine how it should behave with those. Do you want it to count a matrix as “in stock” if any of its child items is in stock?
Regards,
Donogh
Hi @donogh
Thanks for the reply. It’s works great with simple products or products with all matrix in stock with NSync condition.
Now i Would like determine if any of my matrix are in stock to put “1” in product_priority field.
Regards,
Damien
Hi Damien,
we have a solution for you but need to do few tests to check if it’s working correctly. I will get back to you asap. Please bear with me.
Regards,
Sebastian
1 Like
donogh
October 20, 2017, 5:05pm
5
Hi Damien,
This should work fine as a product_priority mapping:
(CASE WHEN (quantity-quantitycommitted) > 0 THEN 1 ELSE 0 END)
You’ll need to ensure ‘Sort my search results by highest priority first’ is enabled (under All Config Options).
Regards,
Donogh