I am developing a magento site where there is a left sidebar called "shop by category" by default in magento theme. I have created a category and there are some subcategories under parent category. When I go to parent category, it shows list of products as well as left sidebar with subcategories. But when I select subcategories, it shows list of products but left sidebar is missing. Is there any way to rectify it from admin or code level.
Layout wise, magento distinguishes categories as
default categories and
layered categories. Magento uses
is anchor option in order to make this categorization. If
is anchor is set to
yes, then that category would be
layered category and if it is set to
no, then that category will treat as a
What happens when we set the property
is anchor to yes ?
Then the category will become a layered category. A category which holds layered navigation section along with it. Layered navigation will hold product attribute list which we set to include in layered in layered navigation so that we can filter products in a particular category using those product attriubte.
color attribute is an example.
Another important thing about layered category - it will display all products not only from the selected category, but from its subcategories.
In this case, magento will process a unique layout handle
What happens when we set the proeprty
is anchor to no ?
Now these categories become default categories. Categories which will not show layered navigation section. So product attribute filtering is not possible for this type of categories.
Also a default category only show products which are assigned with that category itself. There is no possibility that it will show products that comes under its child categories.
In this case, Magento will process a unique layout handle
What is the problem here ?
You set all of your categories to default, coz
is anchor property of all categories is set to no in your case.
There is very interesting point that I need to share with you in this case. If you take Magento's default theme (
base/default), you can see that, layout handle for default categories
catalog_category_default actually defines a left section. It looks like this.
<catalog_category_default translate="label"> <label>Catalog Category (Non-Anchor)</label> <reference name="left"> <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> </reference> ... </catalog_category_default>
This means it uses the block of type
catalog/navigation in the
left section. This block is actually responsible for the left content that you are viewing in a
If you check inside
catalog_category_layered, it uses another block of type
catalog/layer_view to show the left section. So this block is obviously used to show the layered navigation section.
So the question is what is
catalog/navigation block does for default categories ?
To answer the question, please have a look on the template file which is set with this block
You will find this line there.
<?php if (!Mage::registry('current_category')) return ?> <?php $_categories = $this->getCurrentChildCategories() ?>
It is clear that it collects all of its child categories and show as a link to filter. This means
category filtering is always available in every category irrespective of the value set to the field
So if you can see categories for a parent category and it seems empty for a child category, then that means the child category that you are describing actually does not hold any other child categories. At least this is the default case.
If the child category that you are referencing actually holds other child categories, then I am sure that some customization on the default behaviour is took place and you need to trace it out !!
- Go to the Magento backend.Click on the Catalog > Manage Categories.
- Click on the subcategory which is not showing the left navigation. then click on the "Display Settings".
- Under Is Anchor select Yes and save.
- Clear the cache and check