Back to Top

Magento Add new tab in customer grid

Updated 15 October 2012

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

Searching for an experienced
Magento Company ?
Find out More

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 !!!

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home