我只想覆盖magento自定义帐户
我的文件夹结构是这样的
local
Practise
Coreextended
controllers
Frontend
Customer
AccountController.php
etc
config.xml
而我的
帐户控制器.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
}
}
配置.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
新模块显示在管理员配置设置中。但是当我尝试浏览登录页面时,没有一个模具正在打印。它仍然显示正常页面。我错过了什么...
最后你的配置.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>
并检查控制器的包含路径或在下面使用,'
<?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
/中的缓存/,如果您使用企业版,则清除var/full_page_cache/
。就是这样。