Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Removing links from top menu using local.xml

Tags:

magento

Does anyone know how I can remove links from the top menu using local.xml.

In the default checkout.xml there is:

<reference name="top.links">
    <block type="checkout/links" name="checkout_cart_link">
        <action method="addCartLink"></action>
        <action method="addCheckoutLink"></action>
    </block>
</reference>

And I would like to remove the addCartLink from the top menu. One way would be just edit the checkout.xml file, but it think it would be a much better solution just to add the remove to my local.xml file, but I can't seem to get the right name to remove. If I do a

<layout>
    <default>
        <remove name="top.links" />
    </default>
</layout>

That does remove the entire menu, but how do I remove just a single item from the menu using locale.xml?

I am using Magento 1.6

like image 346
MTilsted Avatar asked Oct 14 '11 15:10

MTilsted


3 Answers

You can do this in local.xml:

<default>
  <reference name="top.links"> 
    <action method="removeLinkByUrl">
      <url helper="checkout/url/getCartUrl" />
    </action> 
  </reference>
</default>

It was also my question How can i get the full path in local.xml file

like image 146
Md. Abdullah Al Mamun Avatar answered Nov 15 '22 11:11

Md. Abdullah Al Mamun


<default>
 <reference name="top.links">
    <block type="wishlist/links" name="wishlist_link"/>
    <action method="removeLinkBlock"><blockName>wishlist_link</blockName></action>
 </reference> 
</default>

Add this part to your local.xml. Writing this under default will remove it from every page. So adjust it accordingly. I hope this will help you.

like image 45
Nikhil_K_R Avatar answered Nov 15 '22 12:11

Nikhil_K_R


It should be:

<layout>
     <default>
        <reference name="top.links">
            <reference name="checkout_cart_link">
                <remove name="top-link-cart" />
            </reference>
        </reference>
     </default>
</layout>

But you can always copy the checkout.xml in your local theme and edit it.

like image 4
Nasaralla Avatar answered Nov 15 '22 11:11

Nasaralla