Here I attached the picture showing what I'd like to remove (shopping cart tab in the customer admin page).
2 Answers
Below was tested and worked.
Assume that your custom module is Mynamespace_Mymodule
Override the block app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
In order to override add the below XML content in app/code/local/Mynamespace/Mymodule/etc/config.xml
<config>
....
<global>
<blocks>
<adminhtml>
<rewrite>
<customer_edit_tabs>Mynamespace_Mymodule_Block_Adminhtml_Customer_Edit_Tabs</customer_edit_tabs>
</rewrite>
</adminhtml>
</blocks>
.....
</config>
Now create the block app/code/local/Mynamespace/Mymodule/Block/Adminhtml/Customer/Edit/Tabs.php with below content.
<?php
class Mynamespace_Mymodule_Block_Adminhtml_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Customer_Edit_Tabs
{
public function _beforeToHtml()
{
parent::_beforeToHtml();
$this->removeTab('cart'); // Put the name of the tab which you want to hide
$this->_updateActiveTab();
return Mage_Adminhtml_Block_Widget_Tabs::_beforeToHtml();
}
}
Finally clear the cache.
The default tabs in the customer edit menu are added in the core file
app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
To remove the "Shopping Cart" tab, you need to extend Mage_Adminhtml_Block_Customer_Edit_Tabs
and override the _beforeToHtml()
function without this portion of code:
$this->addTab('cart', array(
'label' => Mage::helper('customer')->__('Shopping Cart'),
'class' => 'ajax',
'url' => $this->getUrl('*/*/carts', array('_current' => true)),
));
-
i extended the customer module and remove the 'cart' and 'wishlist' tab in my extended file. even after clear the cache still is not working. i am waiting for your answer.– senthilCommented Apr 6, 2015 at 4:19
-
The following solution has more details on how to remove tabs from customer/edit. Extending things on the adminhtml side of things is a little different than on the regular customer view pages. They also use
removeTab('tabname')
instead of simply omitting the part where the tab is added. stackoverflow.com/questions/27604062/… Commented Apr 6, 2015 at 16:07