简体   繁体   中英

How can i add multiple sorting option on category page in magento?

I want mulitple sorting option on the category - product listing p age in magento , where user can search by name then price and then sub category name Any one have nay idea that how can i achieve this ?

thanks, hkp

We have resolved recently a very similar customization with the attendees of my trainings.

If you want to add custom sorting option to Magento Admin you need to override Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection::addAttributeToSort method for adding your custom sorting option logic. In your case it is joining of category name attribute to product collection select.

Then you should override Mage_Catalog_Model_Config::getAttributeUsedForSortByArray method to add your custom sorting option to the dropdown on category view page.

But you don't need to do all of these steps if your custom sorting options is just an product attribute. In this case you need set value of used_for_sort_by property in your attribute to 1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM