Alphabetic Option Value Ordering in Magento’s Layered Navigation

Magento will by default order layered navigation options by position. To use alphabetic values first and foremost, do the following:

Override the Eav_Entity_Attribute_Source_Table model



Override the getAllOptions method as follows:

class Namespace_Module_Model_Eav_Entity_Attribute_Source_Table extends Mage_Eav_Model_Entity_Attribute_Source_Table
    public function getAllOptions($withEmpty = true, $defaultValues = false)
        $storeId = $this->getAttribute()->getStoreId();
        if (!is_array($this->_options)) {
            $this->_options = array();
        if (!is_array($this->_optionsDefault)) {
            $this->_optionsDefault = array();
        if (!isset($this->_options[$storeId])) {
            $collection = Mage::getResourceModel('eav/entity_attribute_option_collection')

            $collection->getSelect()->order(['main_table.sort_order asc', 'value asc']);

            $this->_options[$storeId]        = $collection->toOptionArray();
            $this->_optionsDefault[$storeId] = $collection->toOptionArray('default_value');

        $options = ($defaultValues ? $this->_optionsDefault[$storeId] : $this->_options[$storeId]);
        if ($withEmpty) {
            array_unshift($options, array('label' => '', 'value' => ''));

        return $options;

This uses sort order first, then uses value to order the attribute options.

Adding Values For Multiselect Attributes in Magento

Add this to your XML;

                        <location />
  • This makes the product attributes accessible to the Mage_Sales_Model_Quote_Config class’ getProductAttributes() method. This reads in the sales/quote/item/product_attributes node.

  • This is called by the _assignProducts method of the “`Mage_Sales_Model_Resource_Quote_Item_Collection’s _assignProducts() method, where it adds all of the attributes to the product collection of the quote item collection.

Copy the attributes to the quote item

Unlike copying from quote items to order items, there isn’t an XML method to do this – it has to be accomplished through an observer. Add the following to the config (with the observer / method substituted):


Then create the following method for the observer above:

    public function addAttributesToQuoteItem($observer){
        $quoteItem = $observer->getQuoteItem();
        $product = $observer->getProduct();