Remove block from account pages
I have a nav bar being applied to my site with the following code:
<!-- catalog.xml -->
<default>
<reference name="left">
<block type="catalog/navigation" name="catal开发者_StackOverflow中文版og.leftnav" template="catalog/navigation/left.phtml"/>
</reference>
</default>
But I do not want it to appear on the account pages. I tried the following, but it doesn't work.
<!-- customer.xml -->
<default>
<reference name="left">
<action method="unsetChild"><name>catalog.leftnav</name></action>
</reference>
</default>
What am I doing wrong?
THe cuprit with this sort of thing is usually the order that the updates are being applied. Your update in the default handle specified in customer.xml
is probably being applied before the update in the default handle specified in catalog.xml
. So unsetChid
is called first, and THEN the block is added in catalog.xml
.
Another reason to place all your updates in local.xml
(update in local.xml
are always loaded last, which means (within one handle), updates in local.xml
will run last)
Apply <remove name="catalog.leftnav"/>
in your customer.xml.that will remove the block.
<!-- customer.xml -->
<default>
<reference name="left">
<remove name="catalog.leftnav"/>
</reference>
</default>
Edit :-
Only want to remove it from account pages
for this you need to remove it from <customer_account>
<customer_account translate="label">
<reference name="left">
<remove name="catalog.leftnav"/>
</reference>
</customer_account>
精彩评论