Magento模块不工作:Adminhtml将选项卡添加到产品视图

时间:2017-05-25 19:05:34

标签: php magento magento-1.7 adminhtml

我无法使用新模块。首先,我只想在adminhtml的“产品编辑”屏幕中添加一个附加选项卡。我希望此标签显示在标准"自定义选项"标签。我的模块显示在Configuration>中高级>高级>禁用模块输出部分。

所以,我有什么,看到任何错误?

路径:app \ etc \ modules \ ns> _CustomerHistory.xml

<?xml version="1.0"?>

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

路径: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>

路径:app \ code \ local \ ns&gt; \ 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';
    }
}

?>

路径: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>

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

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

这里不言而喻,任何帮助都将不胜感激!

0 个答案:

没有答案