3

Ok so I've made a quick module. All seems to be working fine, corn job is running, admin section working and logging is working fine. However the order status I've defined in my XML is not appearing in the back end.

config.xml

....
<global>
    <sales>
        <order>
            <statuses>
                <pending_canceled translate="label">
                    <label>Timed Out</label>
                </pending_canceled>
            </statuses>
            <states>
                <canceled>
                    <statuses>
                        <pending_canceled/>
                    </statuses>
                </canceled>
            </states>
        </order>
    </sales>
    ...
</global>
...

I've been googeling around for a few hours now and have found very sparse resources on this. Some mention adding a dependency to Mage_Sales and some mention having to now run this through PHP, but the only example of this I was able to find was a french article

Does anyone have an example of doing this in 1.9 (or 1.7 above I suppose). I get the feeling I'll need to run a script on install but I'm not sure how these install scripts run (if they're run once and its added, or if it needs to run constantly, or remove on uninstall...)

5

If you look at the config.xml of Mage_Sales module, you'll see

/**
 * @depraceted after 1.4.2, statuses are saved into sales_order_status table
 */
<statuses>
    ...

Order statuses and states are saved in the database. There should be plenty of references on how to add them manually or programmatically. Here is one http://www.techytalk.info/programmatically-add-new-order-state-and-status-in-magento/

How to create installation scripts is another question for which resources are already available as well.

|improve this answer|||||
  • This answer should be the accepted one. – LittleBigDev Dec 29 '15 at 9:04
1

Make sure you assign your new "order status" to a "order state". (within your Magento Admin)

  1. Make new order status here - System -> Order Statuses.
  2. Then click "Assign Status to state" button on the same page.
  3. Now match the new status to a state.
|improve this answer|||||
  • The OP is clearly wanting to add the new order status programatically. – Dom Jul 25 '17 at 11:15

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.