Magento – Error extends AccountController.php in magento

controllersmagento-1.7

I'm trying to extend the core AccountController.php -> app/code/core/Mage/Customer copied it to app/code/local/Mage/ and add a log to see which extends properly.

In the file AccountController.php (app/code/local/Mage/Customer/controllers)
...
...
public function createPostAction() {
        Mage::log('In app/code/local/Mage/', null, 'test.log', true);
...
...

AND CORE (only test)
In the file AccountController.php (app/code/core/Mage/Customer/controllers)
...
...
public function createPostAction() {
        Mage::log('In app/code/core/Mage/', null, 'test.log', true);
...
...

And does not go through code/local/ Mage but by CORE. I need to configure something or it fails?

So I created a separate module following this tutorial: http:// aqpredict.com/blog/overriding-account-contoller-magento/ does not work.

anyone has an example of this, thanks.

Best Answer

I answered this question of yours over at StackOverflow:

The logic through which controller class definitions are loaded builds the path to the file above the explicit include paths on which the autoloader relies. This means no local vs. core precedence.

You need to creat a controller rewrite by specifying a directory under the xpath frontend/routers/customer/args/modules/your_module

The latter node needs the before attribute set to Mage_Customer and you will need to create an AccountController.php with a createPostAction() method. Depending on your needs you may or may not need to extend from and require the core account controller class.