How do I properly overwrite Magento core functionality? I want to create a module that does it.

I need to edit this file: app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php

I know there is a option to copy this file to app/code/local/Mage/Adminhtml/Model/Sales/Order/Create.php and add my functionality to it which will let Magento read this file from local folder instead of core folder.

It's a easy way of doing but by creating a custom module it's easier to manage all the changes I have done.

So here is what I have done so far:

I have created a /app/etc/modules/MyCompany_MyModule.xml config file with following content:

<?xml version="1.0"?>


This is my second file in app/code/local/MyCompany/MyModule/etc/config.xml and it's content:

<?xml version="1.0"?>


I know these two files are essential for any module to work.

Now, what file do I need to create now if I want to overwrite this file? Could someone explain this to me?


Add below code inside <config> tag in config.xml file


then add below code in MyCompany/MyModule/Adminhtml/Model/Sales/Order/Create.php file

class MyCompany_MyModule_Adminhtml_Model_Sales_Order_Create extends Mage_Adminhtml_Model_Sales_Order_Create
     echo "Hello World!"; die();
| improve this answer | |
  • Great thank you. In the config.xml file does it have to go between <config> tags or add new <global> tags? I just been reading one tutorial and it was there so just making sure. – Greg Nov 1 '17 at 14:06
  • yeah in the <global> tag inside <config>.forget to mention that.. I updated my answer – Abhishek Panchal Nov 1 '17 at 14:10
  • Great! Thanks for your interest. I actually found some tutorial how to do it now. I was searching wrong. In here, I am overwriting Magento Model and when I was searching for "How to overwrite Magento functionality there was also Helpers etc which got me confused. Anyway, I got the! Thank you one more! – Greg Nov 1 '17 at 14:13
  • You're welcome! – Abhishek Panchal Nov 1 '17 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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