Jim Todd
Jim Todd

Reputation: 15

Hide category menu using local.xml

How to hide category/menu bar on selected pages like login & registration using local.xml ? I'm using magento 1.7.0.2

Upvotes: 0

Views: 972

Answers (2)

Slimshadddyyy
Slimshadddyyy

Reputation: 4073

Remove nodes will be processed after all layout handles are merged, and are a good way to remove a block regardless of which layout handle loaded the block; you just want to get rid of it entirely for some handles! It also removes recursively, so all you need to specify is the layout handle.

On the other hand, you may only want to remove a block from a reference in a specific layout handle, in which case you should use unsetChild. It is often used to remove a block from a reference, but then re-insert the same block with a different position. This would not have been possible with remove.

Upvotes: 0

Sergey Kolodyazhnyy
Sergey Kolodyazhnyy

Reputation: 691

You need to remove block named 'catalog.topnav' for login and registration page handlers. The page handler similar to page URL, but all slashes replaced with '_'. For the login page it will be *customer_account_login* and for the registration page - *customer_account_create*. You can use

<remove name="[blockname]"> 

or

<action method="unsetChild"><block>[blockname]</block></action>

instructions, first allow you to remove block globally and the second one remove it from certain block.

The Layout update for default magento theme will looks like:

<?xml version="1.0"?>
<layout version="0.1.0">
    <customer_account_login>
         <remove name="catalog.topnav" />
    </customer_account_login>
    <customer_account_create>
         <remove name="catalog.topnav" />
    </customer_account_create>
</layout>

There is some explanation about Magento layouts which can be useful - http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-4-magento-layouts-blocks-and-templates

Upvotes: 1

Related Questions