Magento 1.7 - 覆盖system.xml

问题描述:

我想仅向特定客户群展示付款方式,因此我想在后端付款方式中添加配置字段。我试图覆盖Mage_Payment的system.xml在我的自定义模块:Magento 1.7 - 覆盖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添加此它工作正常,但我不会编辑核心文件,但覆盖将无法正常工作。

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

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