Magento: exclude category filter from Layered Navigation

Magento: exclude category filter from Layered Navigation

There are several situations when we don’t need the Category filter on Magento layered navigation and we need to get rid of it. One simple way to do this, is to modify the view where filters are rendered, check if the filter type is a category and exclude it from rendering.

Magento layered navigation filters are rendered in app/design/frontend/base/default/template/catalog/layer/view.phtml. First of all, we copy this file into our template: app/design/frontend/<your_theme>/default/template/catalog/layer/view.phtml.

Then, we open this file for editing, and look at like ’47’:

<?php if($_filter->getItemsCount()): ?>
<li><?php echo $_filter->getHtml() ?></li>
<?php endif; ?>

We modify the line ’47’ by adding a check for the filter type:

<?php if($_filter->getItemsCount() && $_filter->getType() != "catalog/layer_filter_category"): ?>

We save the file, clear Magento cache, and there we go.


Share this post

Comments ( 0 )

Leave a comment