Sort By Count Magento Layered Navigation -

find this line  in Mage/Catalog/Model/Layer/Filter/Abstract.php. and replace it
public function getItems()
{
    if (is_null($this->_items)) {
        $this->_initItems();
       
        return $items;
    }
   


<--replace-->
public function getItems()
{
    if (is_null($this->_items)) {
        $this->_initItems();
    }

    //5-16-11 Custom sort
    $items = $this->_items;
    usort($items, array("Mage_Catalog_Model_Layer_Filter_Abstract", "sortByCount")); 
    return $items;
}

public static function sortByCount($a, $b)
{
    if ($a->getCount() == $b->getCount()) {
        return 0;
    }
    return ($a->getCount() > $b->getCount()) ? -1 : 1;
}

<!-end->

Comments

Popular Posts

Magmi Single and Multiple Category Importer