Magento - How to add/remove links on my account navigation?

Moon picture Moon · Dec 30, 2009 · Viewed 124.1k times · Source

I am trying to remove links on my account navigation. I looked at the customer/account/navigation.phtml template. The template grabs links by $this->getLinks(). How do I edit getLinks() method so that I can remove some of links?

Answer

zlovelady picture zlovelady · Dec 3, 2010

If you want to selectively remove links without having to copy/edit entire xml files, a nice solution can be found in this post in the magento forums

In this solution, you override the Mage_Customer_Block_Account_Navigation block with a local version, that adds a removeLinkByName method, which you then use in your layout.xml files, like so:

<?xml version="1.0"?>
    <layout version="0.1.0">

    <customer_account>
        <reference name="customer_account_navigation" >
                <!-- remove the link using your custom method -->
                <action method="removeLinkByName">
                   <name>recurring_profiles</name>
                </action>
                <action method="removeLinkByName">
                   <name>billing_agreements</name>
                </action>
        </reference>
    </customer_account>
</layout>