Magento: expand „sort by“ list – „sortieren nach“ Liste erweitern
you want to expand the default sort by list, without add new attributes? The solution:
extends the class Mage_Catalog_Model_Config and overwrite the function getAttributeUsedForSortByArray() with your own custom option array, f.e. :
class YourNamespace_Catalog_Model_Config extends Mage_Catalog_Model_Config { /** * Retrieve Attributes Used for Sort by as array * key = code, value = name * * @return array */ public function getAttributeUsedForSortByArray() { $custom_options = array( 'custom_selection' => Mage::helper('catalog')->__('Custom Selection'), 'newest_first' => Mage::helper('catalog')->__('Newest first'), 'bestselling' => Mage::helper('catalog')->__('Bestselling first'), 'promotions_first' => Mage::helper('catalog')->__('Promotions first'), 'price_htl' => Mage::helper('catalog')->__('High to low'), 'Price_lth' => Mage::helper('catalog')->__('Low to high') ); return $custom_options; /* * no further sortable attributes needed. * $options = parent::getAttributeUsedForSortByArray(); return $custom_options + $options; */ } }
2 Comments