magento attributes filter only in last (level 3) category

magento attributes filter only in last (level 3) category

October 9, 2026 · Illustrated author avatarBy Stefan Bogdanescu
magento attributes filter only in last (level 3) category

Hiding Magento Layered Navigation Filters for Specific Category Levels

In Magento, layered navigation filters are enabled by default across all categories. However, there might be instances where you want to restrict these filters to only the last level (level 3) of your category hierarchy. This can improve the user experience by reducing the clutter and narrowing down the product selection.

Understanding the Problem

The current setup allows layered navigation filters in all levels of the category tree. For example, if a customer browses Root Category > Category 1 > Category 1.1, they will see the attribute filters for the entire path—including categories that are not directly relevant to their current selection.

Why Not Use CSS Hacks

As mentioned in your question, you can hide the filters using CSS specifically for certain category pages. While this is a quick and easy solution, it has limitations:

  1. It’s not a scalable approach if you have many categories.
  2. It requires manual updates every time you add or remove categories.
  3. It doesn’t really solve the problem at the core level.

To achieve this without CSS hacks, we need to create a custom Magento extension that modifies the behavior of the layered navigation block. This involves creating an observer for the catalog_block_html_topmenu event and using Magento’s layout handling system.

Here are the high-level steps:

  1. Create a new module in your app/code directory (e.g., app/code/YourCompany/RemoveFilters).

  2. In the config.xml file, define the event observer. The XML should look something like this:

<config>
    <events>
        <catalog_block_html_topmenu>
            <observers>
                <remove_filters>
                    <type>singleton</type>
                    <class>YourCompany_RemoveFilters_Model_Observer</class>
                    <method>removeFiltersInSubcategories</method>
                </remove_filters>
            </observers>
        </catalog_block_html_topmenu>
    </events>
</config>
  1. Create the observer class app/code/YourCompany/RemoveFilters/Model/Observer.php and implement the removeFiltersInSubcategories method. In this method, you can use Magento’s layout handling to remove the layered navigation block from all but the last level categories.

An example of how to do this might look like this:

public function removeFiltersInSubcategories($observer)
{
    $category = Mage::registry('current_category');
    if ($category->getLevel() < 3) {
        // Remove layered navigation for sub-categories
        $layout = Mage::app()->getLayout();
        $layout->unsetBlock('catalog.leftnav');
    }
}
  1. Enable the module in your Magento backend.

  2. Clear the cache.

Conclusion

This approach allows you to cleanly and effectively restrict the layered navigation filters to only the last level of your category hierarchy. It doesn’t require CSS hacks or manual updates for each category page.

Remember, extension development requires a good understanding of Magento’s event-driven architecture and layout handling system. If you’re not comfortable with this level of customization, consider working with a developer or contacting Laravel Company for professional assistance.

By implementing this solution, you can improve the user experience by reducing the visual clutter in your layered navigation. This can lead to better focus on relevant products and potentially higher conversion rates.

Catalog API Extensions Themes

Our network