The question:
I choose my Category XY and get the Product-Grid, on the left side there is the Sub-navigation and below the “Filter Navigation”.
The attribute filters starts with “categories”, “manufacturer”, “size”, ..
How can I disable/remove the filter “categories” from sidebar?
I tried per CSS with
#narrow-by-list dt:first-child {display:none;}
but I cannot remove the categories itself. In which XML I have to remove some blocks? I have no idea .. Thanks for your help.
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
In your theme catalog.xml
file replace the following line
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml" />
with
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
<action method="unsetChild"><child>category_filter</child></action>
</block>
If you’re curious why it works, see Mage_Catalog_Block_Layer_View::_prepareLayout()
Method 2
I realize that this is an older question, but I found this via Google.
For any fellow (future) Googlers;
The (currently) recommended way to make layout changes is using a theme’s local.xml
. So when using local.xml
, add the following:
<catalog_category_layered>
<reference name="catalog.leftnav">
<action method="unsetChild"><child>category_filter</child></action>
</reference>
</catalog_category_layered>
And if you want, you can add the regular (non-filterable) category menu above the filters like by adding the following to your local.xml
:
<catalog_category_layered>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav.categories" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="catalog.leftnav">
<action method="unsetChild"><child>category_filter</child></action>
</reference>
</catalog_category_layered>
Method 3
I used Maurice’s answer but modified it slightly:
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav.categories" template="catalog/navigation/sidebar.phtml"/>
<block type="catalog/layer_view" name="catalog.leftnav" template="catalog/layer/view.phtml">
<action method="unsetChild"><alias>category_filter</alias></action>
</block>
</reference>
Method 4
Remove Category option from Layered Navigation options list in magento
This is what I did to remove the “Category” section from my layered navigation so I wouldnt have any repeat information with the attributes I wanted in the layered navigation.
go to app/design/frontend/default/default/template/catalog/layer and open up view.phtml for edit.
<dl id="narrow-by-list"><?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<?php if($_filter->getName() != "Category"){ ?><dt><?php echo $this->__($_filter->getName()) ?></dt>
<dd><?php echo $_filter->getHtml() ?></dd><?php } endif; ?>
<?php endforeach; ?></dl>
Method 5
This is very old question but it can help to any one who have same stuff like me.
To Remove category list from sidebar you can modify xml files as below.
Remove from layered navigation:
Add below code in local.xml
file if theme have such file:
<catalog_category_layered>
<reference name="catalog.leftnav">
<action method="unsetChild">
<child>category_filter</child>
</action>
</reference>
</catalog_category_layered>
Add below code in catalog.xml
file if local.xml
not exists:
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
<action method="unsetChild">
<child>category_filter</child>
</action>
</block>
Remove from category default page:
Add below code in local.xml
file if theme have such file:
<reference name="catalog.leftnav" >
<action method="unsetChild">
<child>category_filter</child>
</action>
</reference>
Add below code in catalog.xml
file if local.xml
not exists:
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml">
<action method="unsetChild">
<child>category_filter</child>
</action>
</block>
Remove from catalog search page:
Add below code in local.xml
file if theme have such file:
<catalogsearch_result_index>
<reference name="catalog.leftnav">
<action method="unsetChild">
<child>category_filter</child>
</action>
</reference>
</catalogsearch_result_index>
Add below code in catalogsearch.xml
file if local.xml
not exists:
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml">
<action method="unsetChild">
<child>category_filter</child>
</action>
</block>
Note: Please clear your cache if you have enabled it in your admin.
Method 6
Go to Catalog > Attribute > Manage Attribute and go to the price attribute and color attribute click on both and in frontend properties their is “Use In Layered Navigation” make it as NO. and save
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0