Magento:“覆盖"通过本地副本获取核心config.xml文件?这样对吗? [英] Magento: "overriding" core config.xml files via a local copy? Is this correct?
问题描述
我正在尝试重命名Magento结帐中显示的某些信用卡(例如,"Visa"变成"Visa Debit/Credit").
I'm trying to rename some of the credit cards which appear on my Magento checkout (e.g. "Visa" becomes "Visa Debit/Credit").
为此,我发现您必须编辑/app/code/core/Mage/Payment/etc/config.xml
中定义的名称.
To do this, I discovered you must edit the names as defined in /app/code/core/Mage/Payment/etc/config.xml
.
不想覆盖核心文件,我尝试将此文件复制到/app/code/local/Mage/Payment/etc/config.xml
并在那里进行更改,但是没有用.通过研究,我发现Magento不会首先从本地文件夹自动加载配置文件?
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?
然后我发现您可以更改app/etc/modules/Mage_All.xml
并指定<codePool>local</codePool>
而不是<Mage_Payment>
下的<codePool>core</codePool>
.我在本地文件夹下所做的更改将起作用.
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.
这是正确的方法吗?更改核心模块的codePool
有什么影响吗?还有其他方法可以替代"核心模块的config.xml
?
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
?
推荐答案
您必须在local:Yourcompany_Payment
You have to create a new module under local : Yourcompany_Payment
在此模块中,使用所需的XML重写定义一个最低限度的etc/config.xml:
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> [...]
,然后在app/etc/modules
文件夹中,添加一个新的Yourcompany_Payment.xml
(或Yourcompany_All.xml):
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>
depends节点至关重要,因为它将告诉magento在magento的XML之后加载XML,以便您重写工作
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
这篇关于Magento:“覆盖"通过本地副本获取核心config.xml文件?这样对吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!