Knowledgebase

How to disable layered navigation in Magento

Layered navigation is a very useful feature of Magento. However, if for some reason you want to disable it, there are a few things that you can do.

One thing you can do is to edit your product categories and make sure they are not anchored. To do this, in the admin panel of your Magento go to Catalog>Manage Categories, then select the category on the left, on the page that opens on the right click on the Display Settings tab, and from the settings that appear make sure that the Is Anchor option is set to No.

A similar alternative is to edit all attributes that are filterable and make them non-filterable. To do this, in the admin panel go to Catalog>Attributes>Manage Attributes, use the search function to find the attributes that are filterable (both with and without results), then edit each of them and set the option Use in Layered Navigation to No.

In both of the described above solutions, however, subcategories will still be shown in the layered navigation menu on the frontend. For example, if you have a category clothes with subcategories shirts and pants, when a customer opens the clothes category on the frontend the layered navigation block will display links to the subcategories within the category.

You can turn off layered navigation completely by editing the code of the catalog.xml file of the theme that you use. For example, let's say that you use the default Magento theme that comes with every installation package, and that your store is installed directly in the public_html directory on your Magento hosting account, meaning it's accessible at yourdomain.com. Then the path on your hosting account to the file that you need to modify would be public_html/app/design/frontend/base/default/layout/catalog.xml. In that file find the code:

<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" 
after="currency" template="catalog/layer/view.phtml"/>
</reference>

and comment it out by placing an exclamation mark and two hyphens after the first bracket (e.g. <!--reference) and two hyphens before the last bracket (e.g. reference-->). To change the file you can download it with an FTP client (e.g. FileZilla), then edit it with a text editor (e.g. Notepad) and upload it back overwriting the old file. In case you want to enable layered navigation just uncomment the same string of code. After you make the change flush the Magento cache and refresh the frontend to see the result.

In case you want to follow best practices you shouldn't edit the code of your theme directly. Instead you can create a subtheme and make the change there. To do this, using the above example, create a folder (e.g. custom_default_theme) on your account in public_html/app/design/frontend/default, and in that folder create another one labeled layout, so it becomes something like public_html/app/design/frontend/default/custom_default_theme/layout. Then in the layout folder copy the original catalog.xml file and make the modification to that file. After that from the admin panel (System>Design) change the design by selecting the custom theme with the modified file.

For basic information on layered navigation and its settings check out the tutorial on managing layered navigation in Magento.

Was this answer helpful?

 Print this Article

Also Read