Instagram

About Me

Photo Profile
Meetanshi Architecture Designer

Meetanshi is found based on providing the best Magento Extensions and Customized eCommerce Business Solutions perfected to the users’ needs. Our Happy users make us Happy. Complete satisfaction to our clients is what drives and motivates us to work hard. Read More

Sunday, October 2, 2022

How to Sort Magento 2 Layered Navigation Attributes Programmatically

The accompanying post is an answer to the request for the qualities in the layered route on the class list page.

For instance, you need to change the arrangement in 1-9 and a-z of the Sort Layered Navigation Attributes Programmatically for Magento 2 on the classification page. The sole reason for this arrangement is to facilitate the inquiry of the clients and furnish them with a better client experience. We should figure out this with a model: In the event that you have a store selling cell phones of the different brands and you have empowered the brand choices in the layered route. Showing the brand name in arranging requests makes it simple for the clients to choose and channel the cell phones of the particular brands.


On the off chance that the character doesn't have a custom source, it utilizes the default source class which is \Magento\Eav\Model\Entity\Attribute\Source\Table


The capability attributeOptionCollection is made on which a capability setPositionOrder($dir, $sortAlpha) is called and all the quality choices are returned in this capability.


In this capability, I have hardcoded sort request of the choices assortment - $this->setOrder('main_table.sort_order', $dir);


For more info: https://meetanshi.com/blog/sort-magento-2-layered-navigation-attributes-programmatically/


No comments:
Write comments


Get more of our update !