I need my module folder structure like app/code/local/ABC/MyNameSpace/MyModule


I am working on a project and client insist of overriding any module in local/ABC folder. If I want to override PQR_XYZ module, then it must be added as local/ABC/PQR_XYZ. There are many other modules overridden with this method but they only overrides models or blocks, and they all work fine.

Please find below code references. config.xml


My Block File is in:


This is working.

Now for overriding a controller, config.xml

                <from><![CDATA[#^/amazon_payments/onepage/#]]></from> <!-- Amazon_Payments_OnepageController  -->
                <to>/abcamazon/amazon_payments_onepage/</to> <!-- ABC_Amazon_Payments_OnepageController  -->

My controller file:


This is not working. I need to override a controller and for a controller, this structure is not working.

Is it possible?

  • 2
    no you can't .it must be {codePool}/{NameSpace}/{Module} Oct 16, 2015 at 12:17
  • i am sure this is possible but don't know how.
    – John
    Oct 16, 2015 at 12:21
  • I am VERY curious for what reason you want to do this. I think you have a problem and you think that this will be the solution... while probably there is a better solution to your initial problem. But then you so have to explain us your initial problem...
    – 7ochem
    Jan 15, 2016 at 20:49
  • Hi @7ochem, I updated the question, please check.
    – John
    Jan 18, 2016 at 7:00
  • @John what is the error that you're getting in case of controller rewrite ? please provide the exception or system logs Jan 18, 2016 at 7:04

1 Answer 1


You could do this by editing the file app/Mage.php. In this file, Magento sets the include paths here. But by doing this, you update the core and after each update, you'll have to change this back again.

But Magento also loads the get_include_path() from your system. So you might also want to add the folder there, but in that case, it will be added at the end of the include path. This means that if file MyNameSpace/MyModule/Block/Test.php also exists in app/code/community, app/code/local or lib, that file will be used in stead of your custom path.

But as 7ochem already said, why do you want to use this custom path? Even after editing your original question, I don't see a reason on why to do this.

  • You said that right. But from the feedback from OP, he is looking for a permanent solution and in that case eidting core file is highly discouraged. Jan 18, 2016 at 7:12
  • Editing the core is ALWAYS discouraged, so adding the path to the vhost's include path might be a better solution. But like I said, if the file exists in the app/code/community folder, Magento will load that file. Jan 18, 2016 at 7:16

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.