覆盖已存在的magento模块adminhtml块

时间:2013-05-02 06:03:32

标签: magento

我试图在Amasty shopby模块中添加一个自定义字段。为此,我需要覆盖adminhtml表单。我为此创建了模块,但不会覆盖现有模块。我必须覆盖“Amasty_Shopby_Block_Adminhtml_Filter_Edit_Tab_General”类。 这是我的代码。

Mycompany_Mymodule.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Mycompany_Mymodule>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Amasty_Shopby />
                <Amasty_Base />
            </depends>
        </Mycompany_Mymodule>
    </modules>
</config>

MyCompany的/ Mymodule中的/ etc / config.xml中

<config>
_____________
______________
    <global>
        <blocks>
            <adminhtml>
                 <rewrite>        <filter_edit_tab_general>Mycompany_Mymodule_Block_Adminhtml_Filter_Edit_Tab_General
                   </filter_edit_tab_general>
                 </rewrite>
            </adminhtml>
        </blocks>
    </global>
 ____________
-________________
</config>

MyCompany的\ Mymodule中\块\ Adminhtml \筛选\编辑\标签\ General.php

public class Mycompany_Mymodule_Block_Adminhtml_Filter_Edit_Tab_General extends Amasty_Shopby_Block_Adminhtml_Filter_Edit_Tab_General
{
 _______________
___________
}

1 个答案:

答案 0 :(得分:3)

你现在试图覆盖的不是Amasty阻止,而是 adminhtml / filter_edit_tab_general 。因此要重写 Amasty_Shopby_Block_Adminhtml_Filter_Edit_Tab_General ,您需要以下配置:

<global>
    <blocks>
        <amshopby>
            <rewrite>
                <adminhtml_filter_edit_tab_general>Mycompany_Mymodule_Block_Adminhtml_Filter_Edit_Tab_General</adminhtml_filter_edit_tab_general>
            </rewrite>
        </amshopby>
    </blocks>
</global>