Custom Tab for Admin Customer/Edit in Magento 1.9

ce-1.9.1.0customer

Followed tons of code tutorial still no luck.. please advise..

let me paste the code below:

app/etc/modules/Loyalty_Customertab.xml:

<config>
    <modules>
        <Loyalty_Customertab>
            <active>true</active>
            <codepPool>local</codePool>
        </Loyalty_Customertab>
    </modules>
</config>

app/code/local/Loyalty/Customertab/etc/config.xml

<config>
   <modules>
       <Loyalty_Customertab>
           <version>0.1.0</version>
       </Loyalty_Customertab>
   </modules>
 <adminhtml>
    <layout>
           <updates>
               <customertab>
                  <file>customertab.xml</file>
               </customertab>
           </updates>
       </layout>
   </adminhtml>  
   <global>
       <blocks>
           <customertab>
               <class>Loyalty_Customertab_Block</class>
           </customertab>
       </blocks>
 </global>
</config>

app/design/adminhtml/default/default/layout/customertab.xml

<?xml version="1.0"?>
<layout>
    <adminhtml_customer_edit>
        <reference name="customer_edit_tabs">
            <action method="addTab">
                <name>my_custom_tab</name>
                <block>customertab/adminhtml_customer_tab</block>
            </action>
        </reference>
    </adminhtml_customer_edit>
</layout>

app/code/local/Loyalty/Customertab/Block/Adminhtml/Customer/Tab.php

<?php
class Loyalty_Customertab_Block_Adminhtml_Customer_Tab
extends Mage_Adminhtml_Block_Template
implements Mage_Adminhtml_Block_Widget_Tab_Interface {
   /**
     * Set the template for the block
     *
     */
    public function _construct()
    {
        parent::_construct();
       $this->setTemplate('customertab/tab.phtml');
    }
   /**
     * Retrieve the label used for the tab relating to this block
     *
     * @return string
     */
    public function getTabLabel()
    {
        return $this->__('My Custom Tab');
    }
   /**
     * Retrieve the title used by this tab
     *
     * @return string
     */
    public function getTabTitle()
    {
        return $this->__('Click here to view your custom tab content');
    }
   /**
     * Determines whether to display the tab
     * Add logic here to decide whether you want the tab to display
     *
     * @return bool
     */
    public function canShowTab()
    {
        return true;
    }
    /**
     * Stops the tab being hidden
     *
     * @return bool
     */
    public function isHidden()
    {
        return false;
    }
}

Best Answer

<codepPool> should be <codePool>. You can turn on the system logs in the admin panel -> System -> Configuration -> ADVANCED -> Developer -> Log Settings -> Enabled : Yes. After this you can check them in var/log.

Related Topic