Here we are going to add new custom tab in the Magento Customer Grid by overriding it in our custom module.
1. To override magento customer grid go to your custom module config.xml
<config>
<global>
<blocks>
<adminhtml>
<rewrite>
<customer_edit_tabs>Webkul_modulename_Block_Adminhtml_Customer_Edit_Tabs</customer_edit_tabs>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
2. Create a file tabs.php at following path
app/code/local/Webkul/Modulename/Block/Adminhtml/Customer/Edit/
3. Copy the entire code from this file app/code/core/Mage/Adminhtml/Block/Customer/Edit/tabs.php
to your tabs.php (app/code/local/Webkul/Modulename/Block/Adminhtml/Customer/Edit/)
4. Add this code to create new tab
$this->addTab('payment', array(
'label' => Mage::helper('customer')->__('Payment Mode'),
'content' => $this->paymentmode(),
));
inside function _beforeToHtml()
protected function _beforeToHtml()
{
if (Mage::registry('current_customer')->getId()) {
$this->addTab('payment', array(
'label' => Mage::helper('customer')->__('Payment Mode'),
'content' => 'Your content Come Here',
));
}
}
/*note: in 'content' you can pass a string or function*/
/* passing function */
protected function _beforeToHtml()
{
if (Mage::registry('current_customer')->getId()) {
$this->addTab('payment', array(
'label' => Mage::helper('customer')->__('Payment Mode'),
'content' => $this->paymentmode(),
));
}
}
/* write these line after completion of function 'protected function _beforeToHtml(){}'*/
protected function paymentmode()
{
return 'Your content Come Here';
}
5. Save and Enjoy !!!
Be the first to comment.