Hi I'm trying to override Mage_Customer_AccountController, so that I can extend the createPostAction method. For the life of me I can't seem to do this, it either throws a 404 page, which suggests that its not the right path for the file or it defaults to orignal.
<rewrite>
<company_modulename_account>
<from><![CDATA[#^/customer/account/#]]></from>
<to>/modulename/account</to>
</company_modulename_account>
</rewrite>
My controller is located here local/company/modulename/controllers/AccountController.php
To override a controller, you have to create a subclass to define existing functions. Now select a function from the controller for overriding from the addons. For better understanding, I have selected the following Carousel Recently viewed function for overriding.
Instead, you can try as:
...
<frontend>
<routers>
<customer>
<args>
<modules>
<company_modulename before="Mage_Customer">Company_Modulename</company_modulename>
</modules>
</args>
</customer>
</routers>
</frontend>
...
And create a controller class:
app/code/[codePool]/Company/Modulename/controllers/AccountController.php
with the following code:
require_once 'Mage/Customer/controllers/AccountController.php';
class Company_Modulename_AccountController extends Mage_Customer_AccountController
{
public function createPostAction(){
die('Overriden');
}
}
Here is more info about controller overriding:
https://stackoverflow.com/a/7117076/887385
Good Luck!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With