Override price sorting to use max_price in list view?
Question
In a category that's only listing grouped products with several associated products each, I'd like the price sorting to use the max_price
. Seems like it's using the min_price
by default.
Is there an admin option I'm missing, or would I need to go override a model for this?
Thanks!
Solution
You can override this method: Mage_Catalog_Model_Resource_Product_Collection::addAttributeToSort()
.
There is a section for price sorting:
if ($attribute == 'price' && $storeId != 0) {
$this->addPriceData();
$this->getSelect()->order("price_index.min_price {$dir}");
return $this;
}
Change min_price
to max_price
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange