Magento Module Not Working : Adminhtml add tab to Product View

146 Views Asked by At

I'm having trouble getting a new module to work. To begin with I just want to add an additional tab to the Product Edit screen in the adminhtml. I want this tab to show underneath the standard "Custom Options" tab. I have my module showing up in the Configuration > Advanced > Advanced > Disable Module output section.

So here's what I have, seen any mistakes?

Path : app\etc\modules\ns>_CustomerHistory.xml

<?xml version="1.0"?>

<config>
    <modules>
        <<ns>_CustomerHistory>
            <active>true</active>
            <codePool>local</codePool>
        </<ns>_CustomerHistory>
    </modules>
</config>

Path: app\code\local\\CustomerHistory\etc\config.xml

<?xml version="1.0"?>

<config>
    <modules>
        <<ns>_CustomerHistory>
            <version>0.1.0</version>
        </<ns>_CustomerHistory>
    </modules>
    <global>
        <blocks>
            <CustomerHistory>
                <class><ns>_CustomerHistory_Block</class>
            </CustomerHistory>
        </blocks>
        <models>
            <CustomerHistory>
                <class><ns>_CustomerHistory_Model</class>
            </CustomerHistory>
        </models>
    </global>
    <adminhtml>
        <layout>
            <updates>
                <CustomerHistory>
                    <file>CustomerHistory.xml</file>
                </CustomerHistory>
            </updates>
        </layout>
    </adminhtml>
</config>

Path : app\code\local\ns>\CustomerHistory\Block\Adminhtml\Product\Edit\Tab.php

<?php

class <ns>_CustomerHistory_Block_Adminhtml_Catalog_Product_Edit_Tab extends Mage_Adminhtml_Block_Widget 
implements Mage_Adminhtml_Block_Widget_Tab_Interface 
{
    public function canShowTab()
    {
        return true;
    }

    public function getTabLabel()
    {
        return $this->_('Custom Tab');
    }

    public function getTabTitle()
    {
        return $this->_('Custom Tab');
    }

    public function isHidden()
    {
        return false;
    }

    public function getTabUrl()
    {
        return $this->getUrl('*/*/customtab', array('_current' => true));
    }

    public function getTabClass()
    {
        return 'ajax';
    }
}

?>

Path : app\design\adminhtml\default\default\layout\CustomerHistory.xml

    <?xml version="1.0"?>
    <layout>
        <adminhtml_catalog_product_edit>
            <reference name="product_tabs">
                <block type="CustomerHistory/adminhtml_catalog_product_edit_tab" name="custom_tab" template="CustomerHistory/catalog/product/edit/tab.phtml" />
                <action method="addTab">
                    <name>Custom Tab</name>
                    <block>custom_tab</block>
                </action>
            </reference>
        </adminhtml_catalog_product_edit>
    </layout>

Path : app\design\adminhtml\default\default\template\CustomerHistory\catalog\product\edit\tab.phtml

<?php
/**
 * Custom tab template
 */
?>
<div>
    <h1>Hello</h1>
</div>

It goes without saying here, any help would be greatly appreciated!

0

There are 0 best solutions below