php - Magento Customer Module Override is not working -
i want override magento custom account
my folder structure like
local practise coreextended controllers frontend customer accountcontroller.php etc config.xml
and
accountcontroller.php
<?php require_once mage::getmoduledir('controllers', 'mage_customer').ds.'accountcontrollerq.php'; //we need add 1 since magento wont recognize automatically class practise_coreextended_frontend_customer_accountcontrollerextends mage_customer_accountcontroller {//here, extended core controller our public function indexaction() { die('here1'); parent::indexaction(); //you can use default functionality } public function myactionaction() { die('here2'); //my code //you can write own methods / actions } public function mymethod() { die('here3'); //my code //you can write own methods } public function loginaction() {die('here4'); //finally can write code rewrite whole core method //and can call own methods, have full control on core controller } }
config.xml is
<?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>
and 1 more file in app\etc\modules\practise_coreextended.xml
the new module showing in admin configuration settings. when tried navigate login page none of die printing.it still showing normal page. miss anything...
finally config.xml should :
<?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>
and check include path of controller or use below one,'
<?php require_once "mage/customer/controllers/accountcontroller.php"; class practise_coreextended_customer_accountcontroller extends mage_customer_accountcontroller{ }
update:
and 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>
and tried install module (may be) different version. it's better clear registry (module's entry) in core_resource
table. open table , delete if entries regarding module.
and remove cache in var/cache
/ , if using enterprise edition clear var/full_page_cache/
. that's it.
Comments
Post a Comment