Praveesh
Praveesh

Reputation: 1327

How to remove tabs from customer edit page in Magento backend?

In magento, by default 11 tabs are displayed in the customer edit page in the back end. How can I remove tabs from the default list of tabs. What I have done so far:

  1. Created a class to override Mage_Adminhtml_Block_Customer_Edit_Tabs class and then overrode the _beforeToHtml() method.

  2. tried to remove the tabs using

    $this->removeTab('addresses');

Upvotes: 1

Views: 1534

Answers (1)

Removing Customer tabs

a) You have to override Mage_Adminhtml_Block_Customer_Edit_Tabs because the Magento guys did a small typo there: they are adding tabs in _beforeToHtml() method instead of _prepareLayout(). So first you have to modify your config.xml and add:

<global>
<blocks>
    <adminhtml>
        <rewrite>
            <customer_edit_tabs>Yourmodule_Customer_Block_Edit_Tabs</customer_edit_tabs>
        </rewrite>
    </adminhtml>
</blocks>
</global>

In Yourmodule_Customer_Block_Edit_Tabs just copy and paste the Mage_Adminhtml_Block_Customer_Edit_Tabs contents (don’t forget to change the class name!), and rename _beforeToHtml() method to _prepareLayout()

b) Add the removeTab action into your layout xml (default: customer.xml):

<adminhtml_customer_edit>
<reference name="left">
    <block type="adminhtml/customer_edit_tabs" name="customer_edit_tabs">
        <action method="removeTab">
            <name>NAME_OF_TAB</name>
        </action>
    </block>
</reference>
</adminhtml_customer_edit>

You can find out the NAME_OF_TAB, by inspecting the tab’s anchor () and looking for the “name” attribute.

Upvotes: 3

Related Questions