I have the following question:

Add the layerend navigation of a top category, all the filters of all underlying subcategories are shown. In top categories, we only want to show two filters: product type and brand.

We experimented in view.phtml based on other topics, but haven't found the exact result.

It would be great if you could point us towards the solution!


This is what I understood from your question. You want to remove category filter for your two top categories (for them, isAnchor is set to Yes) and keep all other filters as it is.

To achieve this, most easiest solution is a category specific layout update via any of your layout update xml file. For example, your category id be 12. Then add below code in your local.xml file.

File : app\design\frontend\[package]\[theme]\layout\local.xml

        <reference name="catalog.leftnav">  
        <action method="unsetChild"><alias>category_filter</alias></action>

Here CATEGORY_12 is a layout handle update which is specifically created for a category with an id 12. Inside that, we are basically removing category filter from layered navigation.

Hope you get the idea.


So you want to remove category filter and keep all other filters intact. To do that, I believe you need to rewrite the class Mage_Catalog_Block_Layer_View which you can find at app/code/core/Mage/Catalog/Block/Layer/View.php

protected function _prepareLayout()
    $stateBlock = $this->getLayout()->createBlock($this->_stateBlockName)

    $categoryBlock = $this->getLayout()->createBlock($this->_categoryBlockName)

    $this->setChild('layer_state', $stateBlock);
    $this->setChild('category_filter', $categoryBlock);

    $excludeCategories = array(12, 13); //example
    $currentCategory   = Mage::registry('current_category');

    //avoid rendering attribute filters for exclude categories
    if (!in_array($currentCategory->getId(), $excludeCategories)) {
        $filterableAttributes = $this->_getFilterableAttributes();
        foreach ($filterableAttributes as $attribute) {
            if ($attribute->getAttributeCode() == 'price') {
                $filterBlockName = $this->_priceFilterBlockName;
            } elseif ($attribute->getBackendType() == 'decimal') {
                $filterBlockName = $this->_decimalFilterBlockName;
            } else {
                $filterBlockName = $this->_attributeFilterBlockName;

            $this->setChild($attribute->getAttributeCode() . '_filter',


    return parent::_prepareLayout();

Use your category ids in $excludeCategories and you are good to go.

  • Thanks Rajeev! That's indeed what I'm aiming for. Is category_12 the ID for the category itself, or the ID for the specific filter I want to remove? – InlOM Nov 16 '16 at 11:57
  • We're getting there. When I input the category ID in the XML, the two basic filters are hidden (manufacturer, price). But I want the exact opposite: hiding the filters that are loaded from all underlying subcategories. Thanks in advance! – InlOM Nov 16 '16 at 12:03
  • Edit: I tried filter id + _filter (e.g. 186_filter) as an alias in the code: <CATEGORY_12> <reference name="catalog.leftnav"> <action method="unsetChild"><alias>186_filter</alias></action> </reference> </CATEGORY_12> This does not hide filter id 186 on the page for category 12.. Am I missing something? – InlOM Nov 16 '16 at 13:57
  • the code above will remove category filter only. not any other filters. but it will be removed if and only if isAnchor is set to Yes for the category. and the third comment wont work because it has no meaning at all. – Rajeev K Tomy Nov 17 '16 at 3:45
  • Thanks Rajeev. We don't want to hide category_filters, but all the other filters in the topcategory. In subcategories every filter applied in backend can be visible. Next move: custom code in /public_html/app/design/frontend/base/default/template/catalog/layer/view.phtml What I'm trying to accomplish is the following: IF it's a subcategory, THEN output filters for the subcategory are as configured in the backend IF it's NOT a subcategory, THEN only show category_filters – InlOM Nov 17 '16 at 9:16

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.