Magento扩展模块adminhtml表单

时间:2015-07-07 10:46:44

标签: php magento magento-1.9

我正在尝试扩展我正在使用的模块,以便我可以在CMS中的表单中添加额外的文本输入字段。构建CMS表单的模块文件位于以下位置/app/code/community/Zeon/Manufacturer/Block/Adminhtml/Manufacturer/Edit/Tab/Form.php。该文件的内容如下:

class Zeon_Manufacturer_Block_Adminhtml_Manufacturer_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
    implements Mage_Adminhtml_Block_Widget_Tab_Interface
{
//code in here
}

我已创建自定义模块,并在配置文件中包含以下内容

<global>
    <blocks>
        <adminhtml>
            <rewrite>
                <manufacturer_edit_tab_form>MyModule_ZeonExt_Block_Adminhtml_Manufacturer_Edit_Tab_Form</manufacturer_edit_tab_form>
            </rewrite>
        </adminhtml>
    </blocks>
</global>

我的Form.php中包含以下内容:

class MyModule_ZeonExt_Block_Adminhtml_Manufacturer_Edit_Tab_Form extends Zeon_Manufacturer_Block_Adminhtml_Manufacturer_Edit_Tab_Form {
//edited code in here
}

我已经足够轻松地扩展了核心课程,但我似乎无法完成上述工作,有人可以提供任何建议吗?

1 个答案:

答案 0 :(得分:2)

试试这个:

<global>
    <blocks>
        <zeon_manufacturer>
            <rewrite>
                <adminhtml_manufacturer_edit_tab_form>MyModule_ZeonExt_Block_Adminhtml_Manufacturer_Edit_Tab_Form</adminhtml_manufacturer_edit_tab_form>
            </rewrite>
        </zeon_manufacturer>
    </blocks>
</global>

<global>
    <blocks>
        <manufacturer>
            <rewrite>
                <adminhtml_manufacturer_edit_tab_form>MyModule_ZeonExt_Block_Adminhtml_Manufacturer_Edit_Tab_Form</adminhtml_manufacturer_edit_tab_form>
            </rewrite>
        </manufacturer>
    </blocks>
</global>

选中此项以供参考:http://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/

希望这会有所帮助!!