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


-> 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()
        $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

  • Have you tried setting the is Anchor to only the categories you want to show in the layered nav?
    – B00MER
    Dec 1 '14 at 21:26
  • To understand better... Your category tree has only one top category called 'All categories' and a child category of that one called "3M Littmann Stethoscopes"?
    – Marius
    Dec 3 '14 at 8:42
  • @BOOMER yea I have done the anchor thing it doesn't work on the search layered navigation
    – Adam Allen
    Dec 3 '14 at 9:56
  • @Marius Our root category is 'Index', and the child category of that one is 'All categories' and the child of that one is called '3M Littmann Stethoscopes' and so on.
    – Adam Allen
    Dec 3 '14 at 9:59

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.


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

add lines

if ($categoty->getId() == 'YOUR All Categories ID'){
    $categoty = Mage::getModel('catalog/category')
  • Note, it does not change the SQL queries. Please update you question if you wantto modify the backend logic, not just the output.
    – Amasty
    Dec 3 '14 at 13:04
  • Surely that will only work for one category though i would do that for every category ?
    – Adam Allen
    Dec 5 '14 at 11:43
  • So you do want to show categories in 2 levels for each sub-level as here amasty.com/media/wysiwyg/improved-navigation/advcat1.png?
    – Amasty
    Dec 8 '14 at 11:24
  • We just want it set out how it already looks (the pictures in the question) but to start on the child category of "All Categories"
    – Adam Allen
    Dec 8 '14 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.