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.
All I did was add the if statement to allow everything in layered navigation except the group with the name of “Category.” I dont have Minimal Price in my nav but Im sure this would work for that too, just add it in the if statement. My view.phtml file is attached.
Thanks!! it works for me to remove category option from layered navigation.
You can also removes (or change display style )of the categories with our new Layered navigation Pro extension.
Note, that we use SEO-friendly urls in the categories (not blah-bla?cat=34)
there is the php messing which can possibly break your installation but if you want to play it according to the Magento rules and use the layout xml files…
1. open app\design\frontend\yourpackage\yourtemplate\layout\catalogsearch.xml
2. replace
<block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
with
<!-- <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/> -->
3. open app\design\frontend\yourpackage\yourtemplate\layout\catalog.xml
4. replace
<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"/> -->
Hi stass, As far as I understand, your code removes the layered navigation entirely from the catalog and search sections. However the question is “How to remove ONLY categories from the layered navigation”.
yeah that’s true… it removes the entire “shop by” box… sorry I see now I misunderstood the question… you would need to alter php for removing the category option only like previous mentioned .
Another way to do this is via CSS, you will need to add the following bit of php to the following file:
\app\design\frontend\default\theme\template\catalog\layer\view.phtml
as follows:
What the first part does is take the “title” of the attributes (set in the Manage Attributes section in the back) and changes the “title” to lower case and places “-” in place of spaces (in case your attribute name is more than 1 word).
The second part then injects the $tmpTitle variable as a “class” tag for use with some CSS magic!
Now all you need to do is go into your CSS file and e.g. if you want to hide an attribute such as category, make a CSS entry as follows:
.layered-nav .category { display: none; }
or say you want to hide price:
.layered-nav .price { display: none; }
I found this technique gives me more control overall. For instance, on some categories, I might want to display Price while on others I don’t.
Another way to do this is via CSS, you will need to add the following bit of php to the following file:
\app\design\frontend\default\theme\template\catalog\layer\view.phtml
as follows:
What the first part does is take the “title” of the attributes (set in the Manage Attributes section in the back) and changes the “title” to lower case and places “-” in place of spaces (in case your attribute name is more than 1 word).
The second part then injects the $tmpTitle variable as a “class” tag for use with some CSS magic!
Now all you need to do is go into your CSS file and e.g. if you want to hide an attribute such as category, make a CSS entry as follows:
.layered-nav .category { display: none; }
or say you want to hide price:
.layered-nav .price { display: none; }
I found this technique gives me more control overall. For instance, on some categories, I might want to display Price while on others I don’t.
Hope this helps somebody!
I want to style the category section in Layered nav separatly from the rest of the layered nav and thought I could use this code in 1.4 to enable seperate css classes but it wont work.