I want to remove following links in the customer account dashboard left panel?
- My Applications
- Gift Registry
- Reward Points
- Gift Card Link
I'm working in the Magento 1.7 Community Edition. Any help will be appreciated.
I want to remove following links in the customer account dashboard left panel?
I'm working in the Magento 1.7 Community Edition. Any help will be appreciated.
Step 1: Go to ( yourPackage/YourTemplate/customer/account/navigation.phtml )
Step 2: Replace the below 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 */ ?>
The above code snippet contains the way to remove all the navigation links. Hope this will help all.
Reference Link: https://github.com/Aproducktion/Magento-Remove-Dashboard-Links
I see 2 options here.
First and easiest: Just find the layout files that add these menu items and comment the code for them.
For example My applications
is added app/design/frontend/{interface}/{theme}/layout/oauth.xml
through this peice of XML
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="oauth">
<name>OAuth Customer Tokens</name>
<path>oauth/customer_token</path>
<label>My Applications</label>
</action>
</reference>
</customer_account>
The second method, that I'm not 100% sure it will work is to add this xml inside the local.xml
layout file of your theme:
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLinkByUrl"><url>oauth/customer_token</url></action>
</reference>
</customer_account>
You need to add one <action>
tag for each link you want to remove.
There is also the 3rd option, if you are not using the modules at all, just disable them. This can also boost performance.
For this create this file: app/etc/modules/Zzzz.xml
with this content:
<config>
<modules>
<Mage_Oauth>
<active>false</active>
</Mage_Oauth>
</modules>
</config>
You may have some troubles here is some other modules that you want to use, depend on the ones you want to disable.
Mage_Customer_Block_Account_Navigation
doesn't inherit from Mage_Page_Block_Template_Links
.
There is a FOSS extension which adds the backend option to remote account links.
There is a second module (also FOSS) which adds the removeLink
method so that you can use the following in your local.xml
Disclaimer: I am a developer of the second extension.
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLink"><name>OAuth Customer Tokens</name></action>
<action method="removeLink"><name>billing_agreements</name></action>
<action method="removeLink"><name>recurring_profiles</name></action>
</reference>
</customer_account>
The simplest solution (implementation and usage) I've found is to replace Mage_Customer_Block_Account_Navigation
in app/code/local
and add a removeLinkByName
method, which does the same as what Oshan's answer does, but is usable from layout files. A more traditional class rewrite would also work, but could potentially cause conflicts with a plugin.
Warning! Untested!
A more complicated solution would be to write your own module with a Block
which extends Mage_Customer_Block_Account_Navigation
and includes a removeLinkByName
method. For this to work, you would have to remove/unset the customer_account_navigation
block and replace it with the one for your new module. From then on, any time customer_account_navigation
is referenced in layout, you'll get an instance with removeLinkByName
.
A quick solution, to remove all My Account list items below My Orders, including Billing Agreements, Recurring Profiles, My Applications and My Downloadable Products. Will also remove My Wishlist & My Newsletter links, across site, tested on Magento 1.9:
Comment out lines 31 - 66 from app/design/frontend/default/YOURTHEME/layout/wishlist.xml (if not there copy it from app/design/frontend/rwd/default/layout/wishlist.xml)
<!--default>
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link" />
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
<!-- Mage_Wishlist -->
<!--reference name="right">
<block type="wishlist/customer_sidebar" name="wishlist_sidebar" as="wishlist" after="cart_sidebar" template="wishlist/sidebar.phtml" />
</reference>
</default-->
<!--customer_account>
<!-- Mage_Wishlist -->
<!--reference name="customer_account_navigation">
<action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Wishlist</label></action>
</reference-->
<!--/customer_account-->
<!--customer_account_index>
<reference name="right">
<action method="unsetChild"><name>wishlist</name></action>
</reference>
</customer_account_index-->
Comment out lines 47 - 65 from app/design/frontend/default/YOURTHEME/layout/newsletter.xml (if not there copy it from app/design/frontend/rwd/default/layout/newsletter.xml)
newsletter</name>newsletter/manage/</path>Newsletter Subscriptions</label></action> </reference> </customer_account-->
<!--newsletter_manage_index translate="label">
<label>Customer My Account Newsletter Subscriptions</label>
<update handle="customer_account"/>
<reference name="my.account.wrapper">
<block type="customer/newsletter" name="customer_newsletter">
<block type="page/html_wrapper" name="customer.newsletter.form.before" as="form_before" translate="label">
<label>Newsletter Subscription Form Before</label>
</block>
</block>
</reference>
</newsletter_manage_index!-->
CSS (adjust per your requirements)
.block-account .block-content ul li:nth-last-child(1), .block-account .block-content ul li:nth-last-child(2), .block-account .block-content ul li:nth-last-child(3), .block-account .block-content ul li:nth-last-child(4) {
display: none;
}
.cart-table .cart-links > li:last-child {
display:none;
}
To avoid removing the links, I would recommend assigning ID values based on the $_index variable, so you can hide the links via CSS.
Here's what I've done:
From yourPackage/YourTemplate/customer/account/navigation.phtml
<?php foreach ($_links as $_link): ?>
<?php $_last = ($_index++ >= $_count); ?>
<?php if ($this->isActive($_link)): ?>
<li class="current<?php echo ($_last ? ' last' : '') ?>" id="account-link-<?php echo $_index;?>"><strong><?php echo $_link->getLabel() ?></strong></li>
<?php else: ?>
<li<?php echo ($_last ? ' class="last"' : '') ?> id="account-link-<?php echo $_index;?>"><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
So obviously then you can go
#account-link-1 {
display:none;
}
There's no one way to skin a cat, but this is a quick and easy option without really compromising any functionality.
I thought a better solution would be to rewrite the block. This was mentioned above but there was no example:
Add the rewrite to your config.xml in the global section:
<blocks>
<customer>
<rewrite>
<account_navigation>Your_Module_Block_Customer_Account_Navigation</account_navigation>
</rewrite>
</customer>
</blocks>
Override addLink in Mage_Customer_Block_Account_Navigation:
class Your_Module_Block_Customer_Account_Navigation extends Mage_Customer_Block_Account_Navigation
{
private $exclude_links = null;
public function addLink($name, $path, $label, $urlParams=array())
{
if (!$this->exclude_links) {
$this->exclude_links = array(
'OAuth Customer Tokens', /* My Applications */
'downloadable_products', /* My Downloadable Products */
'recurring_profiles', /* Recurring Profiles */
'billing_agreements' /* Billing Agreements */
);
}
if (!in_array($name, $this->exclude_links)) {
return parent::addLink($name, $path, $label, $urlParams);
}
}
}
The exclude_links array could pull from a config setting if you didn't want to hard-code the excluded links.
this is what i googled about this: http://magebase.com/magento-tutorials/5-useful-tricks-for-your-magento-local-xml/
We can change almost all layout aspects of the standard Magento layout however there are some situations when this approach fails. Notably, this manifests itself the minute you want to modify the top.links block. Items in this block are added using the addLink action method so if you are wondering how to remove some links from the default set, the answer is, you can’t! Unfortunately, the page/template_links block class doesn’t implement a 'removeLink' action method so the resort is to remove the whole block using the unsetChild approach and add the links block back with our own links added to it in local.xml.
I would first like you to tell that there are different ways to solve your problems.
It is the easiest way which is find the code in the layout.xml
file inside base which you want to remove for eg: if i want to remove the "My tags" then just comment the portion.
<customer_account>
<!-- Mage_Tag -->
<reference name="customer_account_navigation">
<action method="addLink" translate="label" module="tag"><name>tags</name><path>tag/customer/</path><label>My Tags</label></action>
</reference>
</customer_account>
But you know that we should not modify the base file,so another next simple method that could be performed is
Unsetting the link in your template file.For that copy your navigation.phtml
file to your theme (Note: the folder structure should be same) from the base\default\template\customer\account\navigation.phtml
. which is shown in above answer.
Another tedious task is to rewrite your core module and creating a method "RemoveLinkByName".
A full solution to removing the account dashboard features includes both a client-side and a server-side modification. If only the client-side is removed and/or hidden, then there's nothing stopping tech savvy users from still accessing the features by hand-crafting the routes in their browser or by using a more sophisticated CURL "attack" (which can include the proper CSRF token and slip right through).
The client-side is easily achieved through XML updates as indicated by the plethora of answers already given.
The server-side is a bit more complex and requires an understanding of the functionality that is being removed.
Personally, I would go the route of using observers to conditionally return forbidden HTTP status codes on each of the routes of the feature being removed. In order to find out which routes to observe, open up the associated controller file and find each of the front-end actions that should no longer be available. Next, create a module that defines system configuration fields for soft-disabling said feature. Using these system configuration fields, conditionally update the frontend layout XML and likewise conditionally return the proper HTTP response codes for each observed route.
Code examples for each of the above steps can be found via your favorite search engine.
Add to a local.xml file this code
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink"><name>tags</name></action>
<action method="addLink"><name>recurring_profiles</name></action>
<action method="addLink"><name>newsletter</name></action>
<action method="addLink"><name>billing_agreements</name></action>
<action method="addLink"><name>OAuth Customer Tokens</name></action>
<action method="addLink"><name>downloadable_products</name></action>
</reference>
</customer_account>
Tested in Magento 1.7.0.2