dongtan9253 2012-11-06 11:32
浏览 20
已采纳

Magento:通过本地副本“覆盖”核心c​​onfig.xml文件? 它是否正确?

I'm trying to rename some of the credit cards which appear on my Magento checkout (e.g. "Visa" becomes "Visa Debit/Credit").

To do this, I discovered you must edit the names as defined in /app/code/core/Mage/Payment/etc/config.xml.

Not wanting to overwrite core files, I tried copying this file to /app/code/local/Mage/Payment/etc/config.xml and making my changes there, but it didn't work. From research, I gather than Magento doesn't autoload config files from local folders first?

I then discovered that you could change app/etc/modules/Mage_All.xml and specify <codePool>local</codePool> instead of <codePool>core</codePool> under <Mage_Payment>. My changes made under the local folder would then work.

Is this the correct approach? Will changing the codePool of a core module have any repercussions? Is there some other way to "override" a core module's config.xml?

  • 写回答

1条回答 默认 最新

  • dongza1708 2012-11-06 12:04
    关注

    You have to create a new module under local : Yourcompany_Payment

    In this module, define a minimalist etc/config.xml with the XML rewrite you need :

    <config>
        <modules>
            <Yourcompany_Payment>
                <version>0.1.0.0</version>
            </Yourcompany_Payment>
        </modules>
        <global>
            <payment>
                <cc>
                    <types>
                        <AE>
                            <code>AE</code>
                            <name>American Express</name>
                            <order>0</order>
                        </AE> [...]
    

    And then in the app/etc/modules folder, add a new Yourcompany_Payment.xml (or Yourcompany_All.xml) with :

    <config>
        <modules>
            <Yourcompany_Payment>
                <active>true</active>
                <codePool>local</codePool>
                <depends>
                    <Mage_Payment/>
                </depends>
            </Yourcompany_Payment>
        </modules>
    </config>
    

    The depends node is vital because it will tell magento to load your XML after magento's one in order to your rewrite to work

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi