Magento - Override order controller

Magento - Override order controller

August 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Override order controller

Overriding Magento Order Controllers: A Comprehensive Guide

Hello developers! Today we’re going to tackle one of the most common tasks in Magento development - overriding order controllers. This can be a bit tricky for newcomers, so let’s break it down step by step.

Step 1: Copying the Controller File

You’ve already taken the first step correctly by copying the core file to your custom theme directory:

app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreateController.php

However, you don’t need to copy it into multiple directories. The optimal structure is:

app/code/community/Vendor/Package/controllers/Adminhtml/Sales/Order/

Inside this folder, create a CreateController.php file with your custom class.

Step 2: Defining Your Custom Class

In your new CreateController.php file, define your class as follows:

class Vendor_Package_Adminhtml_Sales_Order_CreateController extends Mage_Adminhtml_Sales_Order_CreateController
{
    // Your custom methods go here
}

Note that the namespace should match your module’s name (Vendor_Package) and follow Magento’s naming conventions for controller classes.

Step 3: Configuring the XML

Now let’s move on to the configuration. You’re on the right track with your config.xml file, but there are a few adjustments needed.

First, remove the <adminhtml> node containing the <modules> array. It’s not necessary and can cause confusion.

Second, update the <args> section of the <partnersystem> router:

<args>
    <module>Vendor_Package</module>
    <frontName>partnersystemadmin</frontName>
</args>

The <modules> node should look like this:

<modules>
    <Vendor_Package before="Mage_Adminhtml">Vendor_Package_Adminhtml_Sales_Order_CreateController</Vendor_Package>
</modules>

Step 4: Defining Your Custom Methods

Now you can start overriding the core functionality. For example, to override the indexAction(), define it in your custom class:

public function indexAction()
{
    // Your custom logic here
    parent::indexAction();
}

The parent keyword calls the original method from Magento’s core.

Step 5: Clearing the Cache

Finally, don’t forget to clear your Magento cache after making changes. This ensures that your overrides take effect immediately:

php shell/indexer.php reindexall
rm -rf var/cache/*

Conclusion

And there you have it - a complete walkthrough of overriding order controllers in Magento! Remember, consistency is key when it comes to directory structures and naming conventions.

If you’re looking for more advanced topics like customizing payment methods or handling multiple websites, I recommend checking out the resources at Laravel Company. They have some excellent articles on Magento development best practices.

Happy coding!

Extensions Themes Admin Configuration

Our network