Every Magento client we’ve worked with, has unique needs and requirements for the customers that use their site. Magento has a big and expansive library of features to fit many of our merchant’s needs but that doesn’t mean that retailers need to execute every feature available in order to provide great customer experience. If we kept all the unnecessary features enabled, it could create a frustrating experience for site users as some features might not do anything. One great example is the customer account navigation menu.
Quite a few customer account navigation links can be turned off easily from the Magento backend by turing off their respective features, but quite a few of these are also hardcoded in Magento through the Magento Core layout XML file. As it is best practice to make layout modifications when possible by using layout XML, I will show you how to remove a few of these links by implementing a layout XML method to remove them via a class rewrite. As an example of a link we’re going to remove, let’s take a look at the Recurring Profiles link in that list.
That link is added with this layout XML declaration in app/design/frontend/base/default/layout/sales/recurring_profile.xml:
This is quite fine as usually there are remove versions of the methods to add things through XML, but when inspecting the block element in use for adding that link (Mage_Customer_Block_Account_Navigation), there is no opposing removeLink for the addLink method. This is where we’re going to start doing our work.
#1. House Our Rewrite in a Module
First things first, we need to house our rewrite in a module. If you have a preexisting module you want to add this to, you can skip creating the app/etc/modules/Acme_Module.xml file.
Create app/etc/modules/Acme_Module.xml. This will tell Magento about our new Module that houses our rewritten class.