Magento – Layered Navigation categories to start one level down

layered-navigationmagento-1.9

We have the standard magento layered navigation down the side of our search page and it works fine except when you search the only category that shows up in "All Categories" and you have to click on that to then see sub categories (in pics below)

enter image description here
enter image description here

My categories are layed out like this

Index

-> All categories

->3M Littmann Stethoscopes

I couldnt find anything if relavance in the filter.phtml and i didnt really understand the Category.php or how i could change it which is the block that it says is being called for the categories in the layered navigation

class Mage_Catalog_Block_Layer_Filter_Category extends Mage_Catalog_Block_Layer_Filter_Abstract
{
    public function __construct()
    {
        parent::__construct();
        $this->_filterModelName = 'catalog/layer_filter_category';
    }
}

So i need to have 3M Littermann stethoscope to be the first category that shows up and not All categories, what will i have to change to get that happening?

Thank you

Best Answer

Please see app\code\core\Mage\Catalog\Model\Layer\Filter\Category.php

It gets the categories using method protected function _getItemsData()

You can change its logic to return required category ID (say 476) when no category.

Example:

find $categoty = $this->getCategory();

add lines

if ($categoty->getId() == 'YOUR All Categories ID'){
    $categoty = Mage::getModel('catalog/category')
            ->load(476); 
}
Related Topic