如何为magento配置添加新字段?

时间:2015-07-01 07:35:49

标签: php magento configuration

我需要在目录 - >下的后端添加一个新的magento配置文件。 “警报电子邮件发件人”(最后)后的产品提醒。任何人都可以为此提供XML吗?

1 个答案:

答案 0 :(得分:1)

您可以将此代码放入模块system.xml

        <catalog>
            <groups>
                <productalert>
                    <fields>
                        <test_field translate="label">
                            <label>some text</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>6</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </test_field>
                    </fields>
                </productalert>
            </groups>
        </catalog>

所有简单的system.xml文件 -

<?xml version="1.0"?>
<config>
    <sections>
        <catalog>
            <groups>
                <productalert>
                    <fields>
                        <test_field translate="label">
                            <label>some text</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>6</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </test_field>
                    </fields>
                </productalert>
            </groups>
        </catalog>
    </sections>
</config>

结果 - new field