0

I have category and i want to sort it by position in ascending order but somehow it is not working on the front end.

Following is my XML

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

I also change the position in category but it is all the same

enter image description here

Any help would be apprciated. :)

1

enter image description here

set above settings and run index command and clear cache.

| improve this answer | |
  • i have followed it but still the same... :( – ibrar ahmad Sep 24 '19 at 12:00
  • Problem is it is not sorted ascending. It is only sorting by descending – ibrar ahmad Sep 24 '19 at 12:05
  • fetch product collection and then try $productcollection->setOrder('position', 'asc')->load(); – Sangeeta Chandaliya Sep 24 '19 at 12:13
  • can you explain it a bit. – ibrar ahmad Sep 24 '19 at 12:15
  • where you are getting product collection data you can add your custom sort condition. – Sangeeta Chandaliya Sep 24 '19 at 12:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.