I've been trying to add a tab to the Customer Information page in Magento CE 1.6.
I've tried the following examples:
- how to add custom tabs to magento customer edit page on mydons.com
- how to add tab in customer information in magento admin on nextbits.eu
- how to add tab in customer information on ankursphp.blogspot.com
The last one is the only one that even seems to come close. However, it has two problems. One is it edits core files and two is that when I click on the tab it spins and dyes. Chrome DevTools show the server reporting 404.
Can anyone provide me with some decent documentation or code that is compatible with Magento 1.6?
Edit Adding the text from the last link as that seems to be the only one that remotely worked.
Override the file
/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tabs.php,Inside_beforeToHtml()method, add the following code:$this->addTab('Custom',array( 'label' =>Mage::helper('customer')->__('Custom'), 'class' => 'ajax', 'url' => $this->getUrl('*/*/custom',array('_current'=>true)), ));Override the file
/app/code/core/Mage/Adminhtml/controllers/CustomerController.php, Add the following code:public function customAction() { $this->_initCustomer(); $this->getResponse()->setBody( Mage::app()->getLayout()->createBlock('core/template')->setTemplate('custom/customer/tab/custom.phtml')->setCustomerId(Mage::registry('current_customer')->getId()) ->setUseAjax(true)->toHtml() ); }Create the file
/app/code/core/Namespace/ModuleName/Block/Adminhtml/Customer/Edit/Tab/and createCustom.php, Add the following source code to the file:<?php class Custom_Custom_Block_Adminhtml_Customer_Edit_Tab_Custom extends Mage_Adminhtml_Block_Widget_Form { public function __construct() { parent::__construct(); $this->setTemplate('custom/customer/tab/custom.phtml'); } } ?>Now, you need to create a template file. Go to
/app/design/adminhtml/default/default/template/modulename/customer/tab/and createcustom.phtml,
Managed to track down some out of the box code that works without any modification as a starting point:
http://www.engine23.com/magento-how-to-create-custom-customer-tab-and-submit-a-form.html
app/etc/modules/Russellalbin_Customertab.xml
app/etc/local/Russellalbin/Customertab/etc/config.xml
app/code/local/Russellalbin/Customertab/Block/Adminhtml/Customer/Edit/Tab/Action.php
app/code/local/Russellalbin/Customertab/controllers/Adminhtml/CustomertabController.php
app/design/adminhtml/default/default/layout/customertab.xml
app/design/adminhtml/default/default/template/customertab/action.phtml