Magento override addAction method(CartController.php) -
what want override addaction method.
what have far is:
config.xml(in mymodule/cartoverride/etc/)
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <mymodule_cartoverride> <version>0.1.0</version> </mymodule_cartoverride> </modules> <frontend> <routers> <checkout> <args> <modules> <mymodule_cartoverride before="mage_checkout">mymodule_cartoverride</mymodule_cartoverride> </modules> </args> </checkout> </routers> </frontend> </config>
mymodule_override.xml(in app/etc/modules/):
<?xml version="1.0" encoding="utf-8"?> <config> <modules> <mymodule_cartoverride> <active>true</active> <codepool>local</codepool> </mymodule_cartoverride> </modules> </config>
and cartcontroller(in mymodule/override/controllers/cartcontroller.php)
<?php require_once 'mage/checkout/controllers/cartcontroller.php'; class mymodule_cartoverride_cartcontroller extends mage_checkout_cartcontroller { public function addaction() { echo 'addaction modified'; die(); // parent::addaction(); } public function indexaction() { echo 'indexaction modified'; // parent::indexaction(); } } ?>
overriding indexaction succesful not addaction(it keeps it's default behaviour). magento version 1.9.1.
Comments
Post a Comment