我只想覆盖magento自定义帐户
我的文件夹结构就像
local
Practise
Coreextended
controllers
Frontend
Customer
AccountController.php
etc
config.xml
和我的
AccountController.php
<?php
require_once Mage::getModuleDir('controllers', 'Mage_Customer').DS.'AccountControllerq.php';
//we need to add this one since Magento wont recognize it automatically
class Practise_Coreextended_Frontend_Customer_AccountControllerextends Mage_Customer_AccountController
{//here, you extended the core controller with our
public function indexAction()
{ die('Here1');
parent::indexAction();
//you can always use default functionality
}
public function myactionAction()
{
die('Here2');
//my code
//you can write your own methods / actions
}
public function mymethod()
{
die('Here3');
//my code
//you can write your own methods
}
public function loginAction()
{die('Here4');
//finally you can write your code that will rewrite the whole core method
//and you can call for your own methods, as you have full control over core controller
}
}
config.xml是
<?xml version="1.0"?>
<config>
<modules>
<practise_coreextended>
<version>0.2.0</version>
</practise_coreextended>
</modules>
<frontend>
<routers>
<customer>
<args>
<modules>
<practise_coreextended before="Mage_Customer_AccountController">
Practise_Coreextended_Frontend_Customer
</practise_coreextended>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
以及app\etc\modules\Practise_Coreextended.xml
新模块显示在管理配置设置中。但是,当我尝试浏览登录页面时,没有任何模具正在打印。它仍然显示正常页面。 我错过了什么......
答案 0 :(得分:2)
最后你的config.xml应该是这样的:
<?xml version="1.0"?>
<config>
<modules>
<Practise_Coreextended>
<version>0.1.0</version>
</Practise_Coreextended>
</modules>
<frontend>
<routers>
<coreextended>
<use>standard</use>
<args>
<module>Practise_Coreextended</module>
<frontName>coreextended</frontName>
</args>
</coreextended>
</routers>
</frontend>
<global>
<rewrite>
<practise_coreextended_customer_accountcontroller>
<from><![CDATA[#^/customer/account/#]]></from> <!-- Mage_Customer_AccountController -->
<to>/coreextended/customer_account/</to> <!-- Practise_Coreextended_Customer_AccountController -->
</practise_coreextended_customer_accountcontroller>
</rewrite>
</global>
<admin>
<routers>
<coreextended>
<use>admin</use>
<args>
<module>Practise_Coreextended</module>
<frontName>admin_coreextended</frontName>
</args>
</coreextended>
</routers>
</admin>
</config>
并检查您的控制器的包含路径或使用下面的&#39;
<?php
require_once "Mage/Customer/controllers/AccountController.php";
class Practise_Coreextended_Customer_AccountController extends Mage_Customer_AccountController{
}
<强>更新强>
和您的Practise_Coreextended.xml
<?xml version="1.0"?>
<config>
<modules>
<Practise_Coreextended>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Practise_Coreextended>
</modules>
</config>
您已经尝试使用不同版本安装此模块(可能)。最好清除core_resource
表中的注册表(模块的条目)。只需打开此表并删除有关此模块的任何条目。
最后删除var/cache
/中的缓存,如果您使用的是Enterprise Edition,请清除var/full_page_cache/
。那就是它。