Magento 1.7 - 覆盖system.xml

时间:2013-03-07 08:57:07

标签: magento system field

我想仅向特定客户群体显示付款方式,因此我想在后端付款方式中添加配置字段。我试图在我的自定义模块中覆盖Mage_Payment system.xml:

MyNamespace_OverwriteCfg.xml

<config>
    <modules>
        <MyNamespace_OverwriteCfg>
            <active>true</active>
            <codePool>local</codePool>
        </MyNamespace_OverwriteCfg>
    </modules>
</config>

的system.xml:

<config>
<sections>
    <payment>
        <groups>
            <invoice>
                <fields>
                    <specificgroup translate="label">
                        <label>Payment on specific customer groups</label>
                        <frontend_type>multiselect</frontend_type>
                        <sort_order>51</sort_order>
                        <source_model>adminhtml/system_config_source_customer_group</source_model>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                    </specificgroup>
                </fields>
            </invoice>
        </groups>
    </payment>
</sections>
</config>

如果我在支付核心system.xml中添加它,它可以正常工作,但我不会编辑核心文件,但覆盖将无效。

1 个答案:

答案 0 :(得分:3)

解决方案是,我的xml节点结构中有一个错误。 添加字段到&#34;货到付款&#34;当然它必须是这样的:

<config>
   <sections>
        <payment>
            <groups>
                <cashondelivery> <!--Here was the mistake -->
                    <fields>
            //...
                    </fields>
                </cashondelivery> <!--Here was the mistake -->
            </groups>
         </payment>
    </sections>
</config>