Overriding the Magento customer controller to have custom form actions -
i've created new template homepage registration , login form. far, actions on both these forms default actions called this:
echo mage::helper('customer')->getregisterposturl()
registration form and
echo mage::helper('customer')->getloginposturl()
login form.
i trying override customer controller change action of these forms. far have: a. created new module , edited app/code/local/myco/homepage/etc/config.xml
file this:
<?xml version="1.0"?> <config> <modules> <myco_homepage> <version>0.1.0</version> </myco_homepage> </modules> <frontend> <routers> <args> <modules> <myco_homepage before="mage_customer_accountcontroller">myco_homepage</myco_homepage> </modules> </args> </routers> </frontend> </config>
b. created controller in file app/code/local/myco/homepage/controllers/indexcontroller.php
, extended mage_customer_accountcontroller
this:
require_once 'mage/customer/controllers/accountcontroller.php'; class bemaad_homepage_indexcontroller extends mage_customer_accountcontroller { public function loginpostaction() { } public function createpostaction() { } }
my problem is: don't know put in action attributes of form , magento doesn't seem register new controller.
does know i've made mistake, or did forget something?
thanks!
your config should follows
<?xml version="1.0"?> <config> <modules> <myco_homepage> <version>0.1.0</version> </myco_homepage> </modules> <frontend> <routers> <customer> <modules> <myco_homepage before="mage_customer">myco_homepage</myco_homepage> </modules> </customer> </routers> </frontend> </config>
additionally overloading controller class must have same controller name overloaded one.
so instead of bemaad_homepage_indexcontroller should bemaad_homepage_accountcontroller
see here reference: http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
Comments
Post a Comment