I am having problems while overriding a core controller. I want to add a new function but it only works if I do it in the core file (code/core/checkout/controllers/onepagecontroller.php).
I have followed some post, but it's not working. Some of them are:
- http://www.magentocommerce.com/boards/viewthread/32979/P0/
- http://www.webspeaks.in/2011/03/override-controllers-in-magento.html
- www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/how_to_overload_a_controller
(I can't add more links, sorry)
I don't know what is happening... maybe you can help me ;).
I'm using magento 1.5 and I have this 3 files:
local -> Arias -> CoreExtended -> etc -> config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Arias_CoreExtended>
<version>0.1.0</version>
</Arias_CoreExtended>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<Arias_CoreExtended before="Mage_Checkout">Arias_CoreExtended_Checkout</Arias_CoreExtended>
</modules>
</args>
</checkout>
</routers>
</frontend>
</config>
app -> etc -> modules -> Arias_CoreExtended.xml
<?xml version="1.0"?>
<config>
<modules>
<Arias_CoreExtended>
<active>true</active>
<codepool>local</codepool>
</Arias_CoreExtended>
</modules>
</config>
local -> Arias -> CoreExtended -> controllers -> Checkout -> OnepageController.php
<?php
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Arias_CoreExtended_Checkout_OnepageController extends Mage_Checkout_OnepageController
{
public function collectAction()
{
echo 'WTF?';
}
public function indexAction()
{
echo "This controller has been overridden.";
}
}
Thanks in advance for your time, regards.