Skip to content


How To Add Custom Order Status to Magento 1.4.1

For those of you who are experienced in the eCommerce world the first thing you will notice with the Magento system is the lack of statuses to accommodate real world order processing.

These a few of the statuses that are provided by default:

  1. Pending
  2. Processing
  3. Complete

This falls short for several different reasons, for instance, lets say that I want to know internally where this order is currently at in the “Processing” state. The basic statuses that are relevant to me for the state “processing” are “Processing, Packaging and Backordered”.

Currently, the Magento forums are littered with “hacks” on how to accomplish this. I am going to show you a quick and easy way to customize state transitions and statuses while retaining the ability to upgrade Magento.

Create Magento Module

First we need to create a basic Magento module (* if you have a module you are using already skip to the config.xml).
in /magento/app/code/local create a folder with a project name that is relevant to you.

so in this case, I will use a generic project name with the following directory structure

Magento/app/code/local
    /MyProject
        /MyCustomStatusesModule
            /Block
            /controllers
            /etc
            /Helper
            /Model
            /sql

Customize Config.xml

Within the etc folder we will need to create a config.xml file.
(location: /Magento/app/code/local/MyProject/MyCustomStatusesModule/etc)

<?xml version="1.0" encoding="UTF-8"?>
<config>
	<modules>
        <MyProject_MyCustomStatusesModule>
            <version>1.0.0</version>
        </MyProject_MyCustomStatusesModule>
    </modules>
 
 
	<global>
    <!-- Add Statuses Here -->
        <sales>
            <order>
                <statuses>
                    <!-- retained for backwards compatibility, not used anymore -->
                    <packaging translate="label"><label>Packaging</label></packaging>
                    <backorder translate="label"><label>Backorder</label></backorder>
                </statuses>
    <!-- Customize The State Transitions -->
                <states>
                    <processing translate="label">
                        <label>Processing</label>
                        <statuses>
                            <processing default="1"/>
                            <packaging default="2" />
                            <backorder default="3" />
                        </statuses>
                        <visible_on_front/>
                    </processing>
                </states>                  
            </order>            
        </sales> 
	</global>  //Update fixed global end tag
</config>

Install Module

Once we have created this basic structure we will now need to let magento know about our new module. For this we will need to create another xml file.

File Name: MyProject_MyCustomStatusesModule.xml
<?xml version="1.0"?>
<config>
  <modules>
    <MyProject_MyCustomStatusesModule>
      <codePool>local</codePool>
      <active>true</active>
    </MyProject_MyCustomStatusesModule>
  </modules>
</config>

This file needs to be placed in /magento/app/etc/modules

Conclusion

Now, if you navigate to the orders section of the Magento admin you should see your new statuses available as search options. Further, if you review an Order that is currently in a processing state you will see that you can now transition the status to your custom defined statuses.

Cheers!

Posted in Magento.

20 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Jerry said

    I tried these instructions and it did not work. Do you place the config file under the modules etc folder (app/code/local/etc) OR just (app/etc)?

  2. Steve Rhoades said

    Jerry,

    That is correct, the config.xml would go in your modules etc directory.

  3. Josh said

    These instructions also didn’t work for me.

    Module is installed, but order statuses are not appearing

  4. Doesn’t quite work as it is. In the config.xml, the and everything within it should be within a .

    i.e.

    …….

  5. Looks like it stripped out my xml tags.

    Basically, the example is missing a global tag around the sales tag.

  6. sip said

    is it possible for you to upload a zip file with this setup for ease of use. i have tried a few times to do this and i dont seem to be able to do it.

  7. Steve Rhoades said

    @Andrew, Thanks for pointing that out.. I have double checked my config and you are correct, I apologize for that. The post has been updated to reflect the correct config.xml configuration.

    @sip I will work on getting a sample module setup in a zip to go along with this post, thanks for the suggestion!

  8. Andy said

    Works great, though there is a typo in config.xml. The at the bottom should be .

    Thanks Steve!

  9. Lukas said

    Hi, still missing end tag of global .

  10. Derak said

    A much better way to go than using the core hacks.
    Thanks for the tip.

    Don’t forget to close the global tag. Its missing a slash.

  11. Jerry said

    I have followed the Tutorial again and still no luck. Cleared cache – nothing. Do I need to Customize Config.xml with something different than what you have above? When I go to the backend all I see is “Processing” and no other options. I would assume based on the code above there would be Packaging and Backorder in addition to Processing. Thanks

  12. i have added in magento1.5 but it’s not working can u telll it’s not showing in admin

  13. Kevin said

    This doesn’t work for me either I’m afraid.
    Is there no PHP code involved at all?

  14. Steve Rhoades said

    @Kevin, There is no PHP code involved. Please note that this has only been testing on 1.4.1. Further you must make sure that you refresh your configuration cache: system > cache management >check configuration, select Refresh and click Submit.

  15. Steve Rhoades said

    @Sandeep, I was under the impression that 1.5 added this functionality? You may want to check into that, since I haven’t had the opportunity to check 1.5 out. The example in this post has only been tested on 1.4.1 however I believe it does work on other versions.

  16. Hugo said

    works fine for me !!!
    Thanks a lot

  17. This way is now deprecated since 1.4.2 as the core sale module indicates it.
    The database driven way is the solution.
    this post is what’s need to be done now:
    http://blog.occi-tech.com/?p=25

Continuing the Discussion

  1. Ajouter un « order status » personnalisé depuis une extension | Agence Web Magento linked to this post on September 18, 2011

    [...] rendant ainsi impossible la personnalisation par le biais du config.xml comme détaillé à divers endroits sur le [...]

  2. Ajouter un « order status » personnalisé depuis une extension | Blog Occitech linked to this post on February 17, 2012

    [...] rendant ainsi impossible la personnalisation par le biais du config.xml comme détaillé à divers endroits sur le [...]

  3. How To Add Custom Order Status to Magento 1.4.1 | Magento Tips linked to this post on April 1, 2012

    [...] How To Add Custom Order Status to Magento 1.4.1 [...]

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.