Hi, I am having a product on how could I sort my product by collection. I have a thousand products uploaded and using a dynamic store page.
I want the product dataset will be sort by collection. and am trying to use this code but not working and products are not displaying at all.
import wixData from ‘Wix-data’ ;
// …
$w( “#dynamicDataset1” ).setSort( wixData.sort()
.ascending( “collections” )
)
.then( () => {
console.log( “Dataset is now sorted” );
} )
. catch ( (err) => {
console.log(err);
} );
My purpose in doing this is to show all the same products respectively not scattered everywhere in the next pages. Example I have a collection name BRAND, and from this BRAND I have sub collection name SHAMPOO, CONDITIONER… etc. NOW when I click the collection name BRAND I want to see first all the shampoo, then after the condition (sorting by collection).
Here our dynamic store page link:
https:// www. enigmabeauty. net/ collections /category/Framesi
Please help. thanks.