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?
-
The free '[Frontend Links Manager](http://www.magentocommerce.com/magento-connect/MagePsycho/extension/7905/frontend_links_manager)' extension lets you do this, except for "My Applications", from the control panel. – ehartwell Mar 17 '13 at 14:38
-
Really nice details and examples to help you add and remove topLinks in Mangeto by using the `local.xml` file: http://www.classyllama.com/development/magento-development/editing-magentos-top-links-the-better-way – Sébastien Grosjean - ZenCocoon May 12 '12 at 15:16
-
You can use this module: https://github.com/netz98/N98_LayoutHelper – Alex Sep 26 '12 at 14:39
-
I built something similar, thought I would share in case someone can use it https://github.com/eyemaginesrobbins/Magento-RemoveAccountNav – Steve Robbins Mar 19 '13 at 19:09
-
2You can also use this free and easy 'plug and play' extension: http://www.magentocommerce.com/magento-connect/manage-customer-navigation-menu.html – Gerard de Visser Sep 25 '14 at 12:47
11 Answers
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>
-
Thats Forum, which Solution is valid , Please specify well if u can – Pratik Joshi Oct 20 '14 at 08:38
-
The answer to your question is ultimately, it depends. The links in that navigation are added via different layout XML files. Here's the code that first defines the block in layout/customer.xml
. Notice that it also defines some links to add to the menu:
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
</block>
Other menu items are defined in other layout files. For example, the Reviews module uses layout/review.xml
to define its layout, and contains the following:
<customer_account>
<!-- Mage_Review -->
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
</reference>
</customer_account>
To remove this link, just comment out or remove the <action method=...>
tag and the menu item will disappear. If you want to find all menu items at once, use your favorite file search and find any instances of name="customer_account_navigation"
, which is the handle that Magento uses for that navigation block.

- 26,809
- 13
- 80
- 104
-
5This solution was created before widespread adoption of modifying layout by performing updates in a local.xml without touching base template files. Modifying the base template files is of course a big no-no since the modification may be lost in a Magento version change. – grok_in_full Apr 17 '12 at 13:48
-
1The free '[Frontend Links Manager](http://www.magentocommerce.com/magento-connect/MagePsycho/extension/7905/frontend_links_manager)' extension lets you do this, except for "My Applications", from the control panel. – ehartwell Mar 17 '13 at 14:51
-
@ehartwell new version of 'Frontend Links Manager' supports all the links available in Magento CE & EE. – MagePsycho Aug 19 '13 at 11:28
-
Hi I'm try to add 2 links but only last added link will display. is their any other way to add multiple links/menu – Kailas Apr 21 '16 at 12:27
The easiest way to remove any link from the My Account panel in Magento is to first copy:
app/design/frontend/base/default/template/customer/account/navigation.phtml
to
app/design/frontend/enterprise/YOURSITE/template/customer/account/navigation.phtml
Open the file and fine this line, it should be around line 34:
<?php $_index = 1; ?>
Right below it add this:
<?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
unset($_links['tags']); /* My Tags */
unset($_links['invitations']); /* My Invitations */
unset($_links['enterprise_customerbalance']); /* Store Credit */
unset($_links['OAuth Customer Tokens']); /* My Applications */
unset($_links['enterprise_reward']); /* Reward Points */
unset($_links['giftregistry']); /* Gift Registry */
unset($_links['downloadable_products']); /* My Downloadable Products */
unset($_links['recurring_profiles']); /* Recurring Profiles */
unset($_links['billing_agreements']); /* Billing Agreements */
unset($_links['enterprise_giftcardaccount']); /* Gift Card Link */
?>
Just remove any of the links here that you DO want to appear.

- 241
- 2
- 4
You can also disable the menu items through the backend, without having to touch any code. Go into:
System > Configuration > Advanced
You'll be presented with a long list of options. Here are some of the key modules to set to 'Disabled' :
Mage_Downloadable -> My Downloadable Products
Mage_Newsletter -> My Newsletter
Mage_Review -> My Reviews
Mage_Tag -> My Tags
Mage_Wishlist -> My Wishlist
I also disabled Mage_Poll, as it has a tendency to show up in other page templates and can be annoying if you're not using it.

- 171
- 1
- 3
-
I think this one is a really clean solution. If you change code, one day it will become problematic, when you want to recover your previous state and you changed so many files... – Sonhja Oct 18 '12 at 11:47
-
If I remember correctly this only disables the output of the html. The blocks are still processed. If you don't want the overhead of the block processing then you'll have to use xml. – gwgeller Oct 17 '13 at 18:05
Its work 100% i am Sure.
Step 1: Go To ( YourTemplate/customer/account/navigation.phtml )
Step 2: Replace This Line: <?php $_count = count($_links); ?>
With:
<?php $_count = count($_links); /* Add or Remove Account Left Navigation Links Here -*/
unset($_links['account']); /* Account Info */
unset($_links['account_edit']); /* Account Info */
unset($_links['tags']); /* My Tags */
unset($_links['invitations']); /* My Invitations */
unset($_links['reviews']); /* Reviews */
unset($_links['wishlist']); /* Wishlist */
unset($_links['newsletter']); /* Newsletter */
unset($_links['orders']); /* My Orders */
unset($_links['address_book']); /* Address */
unset($_links['enterprise_customerbalance']); /* Store Credit */
unset($_links['OAuth Customer Tokens']); /* My Applications */
unset($_links['enterprise_reward']); /* Reward Points */
unset($_links['giftregistry']); /* Gift Registry */
unset($_links['downloadable_products']); /* My Downloadable Products */
unset($_links['recurring_profiles']); /* Recurring Profiles */
unset($_links['billing_agreements']); /* Billing Agreements */
unset($_links['enterprise_giftcardaccount']); /* Gift Card Link */
?>

- 1,449
- 15
- 24
Technically the answer of zlovelady is preferable, but as I had only to remove items from the navigation, the approach of unsetting the not-needed navigation items in the template was the fastest/easiest way for me:
Just duplicate
app/design/frontend/base/default/template/customer/account/navigation
to
app/design/frontend/YOUR_THEME/default/template/customer/account/navigation
and unset the unneeded navigation items before the get rendered, e.g.:
<?php $_links = $this->getLinks(); ?>
<?php
unset($_links['recurring_profiles']);
?>

- 1,308
- 1
- 10
- 10
-
1+1 best option is not modifying core files and having it all in one place – Naoise Golden Jul 31 '12 at 23:17
Open navigation.phtml
app/design/frontend/yourtheme/default/template/customer/account/navigation.phtml
replace
<?php $_links = $this->getLinks(); ?>
with unset link which you want to remove
<?php
$_count = count($_links);
unset($_links['account']); // Account Information
unset($_links['account_edit']); // Account Information
unset($_links['address_book']); // Address Book
unset($_links['orders']); // My Orders
unset($_links['billing_agreements']); // Billing Agreements
unset($_links['recurring_profiles']); // Recurring Profiles
unset($_links['reviews']); // My Product Reviews
unset($_links['wishlist']); // My Wishlist
unset($_links['OAuth Customer Tokens']); // My Applications
unset($_links['newsletter']); // Newsletter Subscriptions
unset($_links['downloadable_products']); // My Downloadable Products
unset($_links['tags']); // My Tags
unset($_links['invitations']); // My Invitations
unset($_links['enterprise_customerbalance']); // Store Credit
unset($_links['enterprise_reward']); // Reward Points
unset($_links['giftregistry']); // Gift Registry
unset($_links['enterprise_giftcardaccount']); // Gift Card Link
?>

- 2,990
- 1
- 21
- 28
Most of the above work, but for me, this was the easiest.
Install the plugin, log out, log in, system, advanced, front end links manager, check and uncheck the options you want to show. It also works on any of the front end navigation's on your site.
http://www.magentocommerce.com/magento-connect/frontend-links-manager.html

- 9
- 2
You can also use this free plug-and-play extension:
http://www.magentocommerce.com/magento-connect/manage-customer-account-menu.html
This extension does not touch any of the Magento core files.
With this extension you are able to:
- Decide per menu item to show or hide it with one click in the Magento backend.
- Rename menu items easily.

- 7,590
- 9
- 50
- 58
My solution was to completely remove the block in local.xml and create it with the blocks I needed, so, for example
<customer_account>
<reference name="left">
<action method="unsetChild">
<name>customer_account_navigation</name>
</action>
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer">
<name>account</name>
<path>customer/account/</path>
<label>Account Dashboard</label>
</action>
<action method="addLink" translate="label" module="customer">
<name>account_edit</name>
<path>customer/account/edit/</path>
<label>Account Information</label>
</action>
</block>
</reference>
</customer_account>

- 455
- 4
- 13