Reputation: 922
I want to remove a category from the left navigation in magento, however i want it to remain in the main navigation top.phtml. So far the only way I can think to do this is with a bit of XML in the local.xml Like so:
<reference name="catalog.leftnav">
<action method="unsetChild"><alias>Item to remove</alias></action>
</reference>
However I don't know the alias of the item i want to unset. The category name is:
To purchase from US online store
& the url is:
to-purchase-from-us-online-store
If anyone could help with this it would be awesome, I have just lost the plot completely.
Thanks
Upvotes: 1
Views: 6025
Reputation: 570
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.
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>
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>
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.
Upvotes: 1
Reputation: 12809
Unsetting via the XML will not help you in this case, that will only disable the whole block, ie the full left navigation.
there's no way (out of the box) to disable a single category on the top nav and not the left nav.
There's a few approaches you could take, although some would be overkill for what you need I am guessing, a simple dirty approach would be:
You could always copy Mage_Catalog_Block_Navigation to the local namespance (app/code/local/Mage/Catalog/Block/Navigation.php)
You could then rename this (Navigationleft.php) and make changes as you require. You would then change the XML statement to use this new block for the left nav
<reference name="left">
<block type="catalog/navigationleft"
name="catalog.leftnav"
after="currency"
template="catalog/navigation/left.phtml"
/>
</reference>
You could always add a new attribute to the Catalog entity and modify the Navigation to use this (show_on_left_nav) along with is_active when showing the items, although this is probably a bit overkill :)
Upvotes: 0