当我在“核心”中的文件结构上创建“本地”结构中的文件时,Magento 看不到这种变化。为什么?可能我需要更改其他文件吗?我更改core/Mage/Cutomer/controllers/AcountController.php
,将更改后的文件放入local/Mage/Cutomer/controllers/AcountController.php
,但没有效果。
Magento 使用“核心”文件。
我个人认为创建自定义模块是更好的方法,因为您可以使用“ModuleName”作为描述来指示该模块将对核心进行哪些更改,并使其他开发人员更容易修改您的代码未来
app/code/local/MageIgniter/ModuleName/controllers/AcountController.php
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer').DS.'AccountController.php';
class MageIgniter_ModuleName_AccountController extends Mage_Customer_AccountController{
}
应用程序/代码/本地/MageIgniter/ModuleName/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<MageIgniter_ModuleName>
<version>0.0.1</version>
</MageIgniter_ModuleName>
</modules>
<frontend>
<routers>
<customer>
<args>
<modules>
<MageIgniter_ModuleName before="Mage_Customer">MageIgniter_ModuleName</MageIgniter_ModuleName>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
/app/etc/modules/MageIgniter_ModuleName.xml
<config>
<modules>
<MageIgniter_ModuleName>
<active>true</active>
<codePool>local</codePool>
</MageIgniter_ModuleName>
</modules>
</config>
阅读更多 @
创建您自己的模块并编写一个与 magento 逻辑挂钩的观察者。
我认为 magento 将代码池作为“核心”。所以它开始在核心直接找到那个类。
因此您可以更改文件应用程序-> 等-> 模块-> Mage_All.xml 找到以下内容并更改代码池,更改为
<Mage_Customer>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Eav/>
<Mage_Dataflow/>
<Mage_Directory/>
</depends>
</Mage_Customer>