Magento – How to add custom options for categories product sorting in magento admin

admincategorysorting

I need to add options to sort by bestseller products/top rated in productsDisplay Settings' tab for categories so that we can choose the default sorting option for each category from admin panel. I want to be able to configure this option for individual categories through the backend

I have followed many tutorials to override the getAttributeUsedForSortByArray() menthod in config.php but options are not displaying in drop-down in admin panel.

Is there any way to have the 'bestseller' and 'top rated' options added to the 'Default Product Listing Sort By" dropdown under display settings tab for categories.

Any help would be greatly appreciated!

Best Answer

You can just add 2 product attributes with the names you want and make them available for sorting.
If you need a custom logic behind it rewrite the method Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSort and add your own case section to handle your attributes.

Here is an example on how it's done for created_at. You can do something similar for your attributes.