Peter Svegrup
Peter Svegrup

Reputation: 154

How to exclude categories from layered navigation by xml?

I found a suggestion how to do this in xml but as it does not work and I can only find ways to do it by changing core/local code, I'm posting here to see if anyone can shed some light on it.

this is the suggestion I found:

<reference name="catalog.leftnav">
    <action method="unsetChild"><alias>category_filter</alias></action>
</reference>

I added this to the catalog_category_default and _layered handles but with no result. On checking the core code it seemed the correct name for the alias should be layer_filter_category and so I changed to that on both handles but that didn't work either.

More as a desperation I also tried nesting reference in another reference to make sure it was loaded but I'm really unsure if this is correct at all?

<reference name="left">
    <reference name="catalog.leftnav">
        <action method="unsetChild"><alias>layer_filter_category</alias></action>
    </reference>
</reference>

It would be much appreciated if anyone could let me know the correct way to do this by xml.

Thanks a bunch in advance!

Upvotes: 2

Views: 4083

Answers (1)

Andrew
Andrew

Reputation: 12809

If you want to do it via XML you should edit catalog.xml

replace:

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

with this:

<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">  
    <action method="unsetChild"><alias>category_filter</alias></action>
</block>

Upvotes: 5

Related Questions