I know this has been asked so many times before however I more so have a question.
I am copying the file
/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
and putting it in
/app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tabs.php
I then edit the Tabs.php
to have a new tab
however when I refresh my screen, I even logged out cleared my cache and logged back in Magento does not seem to read from the app/code/local/mage
directory?
However if I make the same changes in the file located in the core folder my changes work? So why can I not more the file to the local file?
I am using Magento CE 1.9.1.0
Shouldn't I be able to copy any file into the local directory and as long as the folder structure is the same it should load it??
Best Answer
I think none of the other answers (at this time) does it 'the Magento way'. To know how to do it the Magento way, have a look at Magento's Billing Agreements. It adds a tab to the customer edit page as well.
First,
app/design/adminhtml/default/default/layout/sales.xml
:Now you wonder: I have no title or content! No problem. Have a look at the above referenced block
Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Agreement
(inapp/code/core/Mage/Sales/Block/Adminhtml/Customer/Edit/Tab/Agreement.php
). I don't think it's useful to copy/paste the entire file here, but all the magic is there, likegetTabLabel()
,getTabTitle()
andcanShowTab()
. It extendsMage_Sales_Block_Adminhtml_Billing_Agreement_Grid
because there's a grid in it, but you could also extend the more generalMage_Adminhtml_Block_Widget
.You didn't mention the use of your tab, but you can even create a whole layout and then reference it by name:
So here's what you need to do:
Mage_Adminhtml_Block_Widget_Tab_Interface
)No need for event observers, no need for local overrides, no need for editing the core!