简体   繁体   中英

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!

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM