无法覆盖Mage_Sales_Model_Order [英] Can't override Mage_Sales_Model_Order
问题描述
我在config.xml中有这样的部分
I have such section in config.xml
<global>
<models>
<sales>
<rewrite>
<order>Apptha_Reservation_Model_Order</order>
</rewrite>
</sales>
</models>
</global>
此外,我还从此处 http://alanstorm.com/magento_config 下载了Alan Strom配置查看器. 但是当我检查myhost.com/?showConfig=true时,看不到新的重写规则.
In addition, I have download Alan Strom config viewer from here http://alanstorm.com/magento_config but when I check myhost.com/?showConfig=true, I don't see my new rewrite rule.
推荐答案
当模块配置未合并到Magento的配置DOM中时,有以下三种可能性:
There are three possibilities when module configuration is not being merged into Magento's configuration DOM:
- 正在缓存配置.通过刷新系统>缓存管理 中的所有内容来清除它
- 由于模块声明不正确或路径不正确,无法解析模块的 config.xml .
-
global/disable_local_modules
设置为1
或true
-通常,请参见app/etc/local.xml
,但是唯一可以确定的方法是检查整个DOM.
- Configuration is being cached. Clear it by flushing all in System > Cache Management
- Your module's config.xml is not being parsed due to incorrect module declaration or incorrect path.
global/disable_local_modules
is set to1
ortrue
- in general, seeapp/etc/local.xml
, but the only way to know for sure is to inspect the full DOM.
对于(2),仅在清除配置缓存后才应进行故障排除.然后,检查要解析为配置DOM的模块 config.xml 文件的每个条件:
In the case of (2), troubleshooting should occur only after config cache has been cleared. Then, check each of the conditions for your module's config.xml file to be parsed into the configuration DOM:
- 正确的模块声明:一个名称以".xml"结尾的文件,其中包含 app/etc/或 app/etc/modules/中存在的有效XML语法(按照惯例,是后者).
-
该模块包含以下结构(当前SO无法正确显示这些结构; 请参见要点):
- Correct module declaration: an file with a name ending in ".xml" containing valid XML syntax present in app/etc/ or in app/etc/modules/ (by convention, it's the latter).
The module contains structure as follows (currently SO is not displaying these correctly; see gist instead):
真的 当地的
true local
基于上述配置,配置文件必须必须位于 app/code/local/Module/Path/etc/config.xml 中,并且必须包含有效的XML语法以便进行解析.
Based on the above configuration, the config file must be located at app/code/local/Module/Path/etc/config.xml and must contain valid XML syntax in order to be parsed.
如果模块声明和文件路径正确,则可能是语法无效.这可以通过设置开发人员模式标志并确保PHP显示错误来确定(请参见 index.php ).
Provided that module declaration and file paths are correct, the likely culprit is invalid syntax. This can be determined by setting the developer mode flag and ensuring that PHP is displaying errors (see index.php).
这篇关于无法覆盖Mage_Sales_Model_Order的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!