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:
- Pending
- Processing
- 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!
20 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.
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)?
Jerry,
That is correct, the config.xml would go in your modules etc directory.
These instructions also didn’t work for me.
Module is installed, but order statuses are not appearing
Doesn’t quite work as it is. In the config.xml, the and everything within it should be within a .
i.e.
…….
Looks like it stripped out my xml tags.
Basically, the example is missing a global tag around the sales tag.
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.
@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!
Works great, though there is a typo in config.xml. The at the bottom should be .
Thanks Steve!
Hi, still missing end tag of global .
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.
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
i have added in magento1.5 but it’s not working can u telll it’s not showing in admin
This doesn’t work for me either I’m afraid.
Is there no PHP code involved at all?
@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.
@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.
works fine for me !!!
Thanks a lot
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