2

I'd like Magento to always apply a descending sort direction if a user sorts a category by a certain attribute, for instance "price".

PLEASE NOTE: I am not asking how to choose a default sort attribute for a specific category. (i.e in this question: How to list products in descending order?)

I'm asking how - in the event that a user chooses a specific sort option - for Magento to automatically apply descending as the sort direction. Native functionality applies an ascending sort.

Thanks in advance.

1

The default order is set here:

\Mage_Catalog_Block_Product_List_Toolbar::$_direction

I think the easiest is to hook into catalog_block_product_list_collection, check wether the direction comes from GET or from the default and then set it to desc. Be careful, I'm sure you have to set it somewhere else (beside the collection) to show it in the frontend.

The alternative might be to set the default direction in the frontend. But I have't checked the template.

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.