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 th开发者_C百科at 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.
精彩评论