I need to add some custom controller actions in customer module core files in magento. How I can do this without touching the core files? I need to update the following files from the core customer module:


app/code/core/mage/customer/controller/AccountController.php, navigation



Another file is the theme file which I also need to override/overwrite:


Any help would be appreciated.

2 Answers 2


a) frontend/base/default/layout/customer.xml

You should not override this file. If you want to make any in layout, create a new local.xml file in your theme.

b) app/code/core/mage/customer/controller/AccountController.php

You must create a module for overriding the AccountController.php file as follow.

1) app/etc/modules/Namespace_Module.xml

<?xml version="1.0"?>

2) app/code/local/Namespace/Module/etc/config.xml

<?xml version="1.0"?>
                        <namespace_module before="Mage_Customer">Namespace_Module</namespace_module>

3) app/code/local/Namespace/Module/controllers/AccountController.php


class Namespace_Module_AccountController extends Mage_Customer_AccountController
     * Override the required function here, 
     * e.g. createAction
    public function createAction()

That's the proper way you should use to override the controller.

c) frontend/base/default/template/customer/account/navigation.phtml

Simple place this file in your theme using the same hierarchy as follow.


d) frontend/base/default/template/persistent/customer/form/register.phtml

Simple place this file in your theme using the same hierarchy as follow.


e) frontend/mtghost/default/template/catalog/product/view.phtml

This file is already in a custom theme. If its your theme then there is no harm in editing in it. If you have another theme then place this file in it as follow and override.


f) For adding custom tab in customer account, add the file with content below.


<?xml version="1.0" encoding="UTF-8"?>
        <reference name="customer_account_navigation">
            <action method="addLink">
                <label>My custom tab</label>
  • Thanks for the awesome answer. Can I add new functions also in the AccountController.php file and these functions will add to the customer module right? Sep 22, 2016 at 10:22
  • Yes you can add new as well as override old ones. Also you can call the parent class functions which is the true essence of overriding. Sep 22, 2016 at 10:50
  • Thanks and I am using the mtghost magento theme so should I add all the xml in mtghost/default/layout/local.xml which I need to add in frontend/base/default/layout/customer.xml Sep 22, 2016 at 11:07
  • I need to add a new link in account section sidebar of the customer of specific group that's why I have edited the core customer.xml. I have add all the xml in local.xml of the theme but its not working Sep 22, 2016 at 11:14
  • I am not using my own theme I am using mtghost magento theme so I have edited its file directly is there any issue with it. Please, suggest as I am new to magento Sep 22, 2016 at 11:17

You should have your own theme for overwriting template files. something like:


put files you want to overwrite in the exact same part in your theme. configure that the shop uses your theme in magento backend:

system/configuration/general/design/ adjust here package & theme

but there are different ways to do so + you should inform you a bit more

your core file problem

i think simplest solution is:

duplicate that file




make your changes.

but generally you should have an own module and extend your desired function.

  • So I need to add the require_once 'Mage/Customer/controllers/AccountController.php'; in my custom controller file right? Sep 22, 2016 at 9:47
  • also how to inform magento that my module has override function for the customer account? Is it the config.xml that do this but how? Sep 22, 2016 at 9:48
  • You cannot override controller by just changing the code pool b'coz its not bind with autoload class of magento Sep 22, 2016 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.