I am in the process of sorting products by attribute_set_id with the help of a custom module that extends Mage_Catalog_Model_Config. Here is my module's Model/Catalog/Config.php
<?php
class Atwix_Tweaks_Model_Catalog_Config extends Mage_Catalog_Model_Config
{
public function getAttributeUsedForSortByArray()
{
$options = array(
'attribute_set_id' => Mage::getModel("eav/entity_attribute_set")
);
foreach ($this->getAttributesUsedForSortBy() as $attribute) {
$options[$attribute->getAttributeCode()] = $attribute->getStoreLabel();
}
return $options;
}
}
After sorting by attribute_set_id, I want to sort by product name so I attempt to add this to the array:
$options = array(
'attribute_set_id' => Mage::getModel("eav/entity_attribute_set"),
'name' => Mage::helper('catalog')->__('Name')
);
But the catalog page doesn't seem to recognize the second field. I can only ever get one field to work. This is the meat of my extension and all customizations are in this single file. This is the link that the extension is based on: http://www.atwix.com/magento/custom-sorting-product-listing/
Is there another way to use mixed attributes in a collection array? I feel like I'm looking over something.