Magento Extension: Remove any link from My Account navigation

Have you ever tried to remove a My Account navigation item via local.xml, it’s not easy right!? After some research and the help of a few magento community members I came across a snippet of code which allows you to remove items using method=”removeLink”.

 public function removeLink($name)
    {
        unset($this->_links[$name]);
        return $this;
    }

To implement this snippet of code, you had to modify core functionality and I thought to make it a little cleaner, I would create a simple magento extension.

You can download it here: PaulDonnelly_RemoveLink

To remove links view removelinks.xml and uncomment the links you would like to remove.

You may also move the contents of customer_account_navigation to local.xml.

Please note: I have only tested this in 1.7.0.0 and 1.7.0.1. Always take backups!!

 

ShareShare on Facebook0Tweet about this on TwitterShare on Google+0Share on LinkedIn0Share on Reddit0Share on StumbleUpon0

Published by

Paul Donnelly

Hi I'm Paul, an avid Magento Developer from Northern Ireland. With almost 8 years of Magento experience under my belt, I still have a strong passion for it. By day I work as a Senior Ecommerce Developer for one of the top web development agencies in Northern Ireland, Pale Blue Dot. If you'd like to keep up to date with my latest posts and rants, you can follow me on Twitter: @PaulDonnelly

3 thoughts on “Magento Extension: Remove any link from My Account navigation”

  1. Hi Paul,
    This code is excellent.

    My shop is fairly distinct:
    A) All my customers are pre-registered and I don’t allow them to edit any of their details.
    B) All products are free of charge (to the end user), digital downloads.
    Your code allowed me to cut back the account info just to “My Downloads”.
    Perfect!

    Thanks very much.
    Matthew Taylor.

  2. Thanks for sharing this module, this is certainly a handy option to have at one’s disposal.

    An alternate method is to hide the links via css:

    a[href*="customer/account/edit"] { display: none !important; }
    a[href*="customer/address"] { display: none !important; }
    a[href*="sales/order/history"] { display: none !important; }
    a[href*="review/customer"] { display: none !important; }
    a[href*="tag/customer"] { display: none !important; }
    a[href*="oauth/customer_token"] { display: none !important; }
    a[href*="sales/recurring_profile"] { display: none !important; }
    a[href*="sales/recurring_profile"] { display: none !important; }
    a[href*="sales/billing_agreement"] { display: none !important; }
    a[href*="wishlist"] { display: none !important; }
    a[href*="newsletter/manage"] { display: none !important; }

    Although, as a note, I recently learned that there is a reason that all these links don’t remove via the normal local.xml removeLink or removeLinkName methods and that it was by design, this isn’t a “bug” or oversight in the code. The ones that can’t be unset from the local.xml can all be disabled from different places in the Admin, and by disabling the functionality via the admin, you remove all the various locations that functionality pops up throughout the frontend and admin. Pretty clever stuff really, and it makes sense why they “encourage” you to disable it the proper way instead of fishing around for every place. The ones that aren’t hidden around various areas of admin system config can be disabled by disabling their modules under Admin>System>Configuration>Advanced>Advanced>Disable Modules Output> (Like Tags, Reviews, Etc.) Pretty cool and slick Magento Developers, you had me wondering about this for a few years until I learned the logic behind the madness. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − nine =