i have add sort by attributes to products say like below one.

"Publish date"
"Product Name"

Now i want to change sort order based on default attributes. For eg 1: Publish date -> Descending order 2: Product Name -> Ascending order 3: Price -> Ascending order

I tried below xml code in category layout xml update, but by adding it my product are sorted in descending order for all attributes, can i define sort order based on attributes in below code

<referenceBlock name="category.products.list">
        <action method="setDefaultDirection">
            <argument name="dir" xsi:type="string">desc</argument>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.