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!