For full explanation you can refer this http://www.newgenray.com/2015/04/22/creating-custom-tab-on-edit-page-in-an-existing-module-of-magento/
First you need to create a module and you have to define two things one is layout and block
<config>
<modules>
<Newgenray_Coupon>
<version>0.0.1</version>
</Newgenray_Coupon>
</modules>
<adminhtml>
<layout>
<updates>
<newgenray_coupon>
<file>coupon.xml</file>
</newgenray_coupon>
</updates>
</layout>
</adminhtml>
<global>
<blocks>
<newgenray_coupon>
<class>Newgenray_Coupon_Block</class>
</newgenray_coupon>
</blocks>
</global>
Then in file app/code/local/Newgenray/Block/Adminhtml/Promo/Quote/Edit/Tab/Custom.php
class Newgenray_Coupon_Block_Adminhtml_Promo_Quote_Edit_Tab_Custom extends Mage_Adminhtml_Block_Widget_Form
implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
/*public function __construct(){
$this->setTemplate('newgenray_coupon/custom_tab.phtml');
}*/
/**
* Mandatory to override as we are implementing Widget Tab interface
* Return Tab Title
*
* @return string
*/
public function getTabTitle(){
return Mage::helper('salesrule')->__('Custom Tab');
}
/**
* Mandatory to override as we are implementing Widget Tab interface
* Return Tab Label
*
* @return string
*/
public function getTabLabel(){
return Mage::helper('salesrule')->__('Custom Tab');
}
/**
* Mandatory to override as we are implementing Widget Tab interface
* Can show tab in tabs
* Here you can write condition when the tab should we shown or not. Like you see when we create shopping cart rule
* Manage coupon tab doesn't come. If you want that then just make a function and check whether you have information
* in registry or not
*
* @return boolean
*/
public function canShowTab(){
return true;
}
/**
* Mandatory to override as we are implementing Widget Tab interface
* Tab is Hidden
*
* @return boolean
*/
public function isHidden(){
return false;
}
/**
* Defines after which tab this tab should come like you asked you need it below Manage Coupon codes
*
* @return string
*/
public function getAfter(){
return 'coupons_section';
}
public function _prepareForm(){
/* To set the data in the form you need to get the data in registry In my example
* I don't have any registry so I am commenting it. My Form will be blank
*/
//$model = Mage::registry('custom_tab_form_data');
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('rule_');
$fieldset = $form->addFieldset('custom_fieldset', array(
'legend'=>Mage::helper('salesrule')->__('Your Custom Field Set ')
));
$fieldset->addField('name', 'text', array(
'label' => Mage::helper('salesrule')->__('Name'),
'class' => 'required-entry',
'required' => true,
'name' => 'name',
'note' => Mage::helper('salesrule')->__('The name of the example.'),
));
$fieldset->addField('description', 'text', array(
'label' => Mage::helper('salesrule')->__('Description'),
'class' => 'required-entry',
'required' => true,
'name' => 'description',
));
$fieldset->addField('other', 'text', array(
'label' => Mage::helper('salesrule')->__('Other'),
'class' => 'required-entry',
'required' => true,
'name' => 'other',
));
//$form->setValues($model->getData());
$this->setForm($form);
return parent::_prepareForm();
}
}
Then in file app/app/design/adminhtml/default/default/layout/coupon.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<adminhtml_promo_quote_edit>
<reference name="promo_quote_edit_tabs">
<action method="addTab">
<name>promo_quote_edit_tab_custom</name>
<block>newgenray_coupon/adminhtml_promo_quote_edit_tab_custom</block>
</action>
</reference>
</adminhtml_promo_quote_edit>
</layout>
Last step will be activating the module that we have just created
<?xml version="1.0"?>
<config>
<modules>
<Newgenray_Coupon>
<active>true</active>
<codePool>local</codePool>
</Newgenray_Coupon>
</modules>
</config>