Setting new orders to Complete (or any other status) in Magento

Setting new orders to Complete (or any other status) in Magento magento help1 120x120Magento brilliantly provides a configuration option for each of the built-in payment methods to allow you to set the orders status – unfortunately by default the only option you can pick is pending.

Each of Magento’s payment methods are created by the core payment module or as their own modules such as paypal – you can find the core methods in the folder app/code/core/Mage/Payment.

If you take a look in the system.xml configuration file – inside the etc folder then you will find some way down the field definition for the new order status field that you see in the admin. Each of the payment methods has this repeated…

<order_status translate="label">
   <label>New Order Status</label>
   <frontend_type>select</frontend_type>
   <source_model>adminhtml/system_config_source_order_status_new</source_model>
   <sort_order>2</sort_order>
   <show_in_default>1</show_in_default>
   <show_in_website>1</show_in_website>
   <show_in_store>0</show_in_store>
</order_status>

The important bit here is the source_model emelement. By changing the content of this element to the following you will get all of the order status’ in the dropdown.

<source_model>adminhtml/system_config_source_order_status</source_model>

Obviously you don’t want to be messing around changing the core files themselves – so create a module and override this in its own etc/system.xml file.

For other modules – they may do this slightly differently but if you search for order_status or adminhtml/system_config_source_order_status you should be able to find the important line and change it.

  • Derek

    Great post, but one thing I noticed. When setting the new order status to ‘Complete’ for check/money order (as an example), the status is set to ‘complete’ but the state is set to ‘new’ – whereas it would be set to ‘processing’ if it were a CC payment.

    The state of ‘new’ doesn’t allow that order to be included in the lifetime sales total on the dashboard. If I manually set it to ‘processing’ it is then included. Do you know if/how the state can also be set to ‘processing’ for new check/MO orders?

    Thanks again for the informative post!

    • http://www.jimcode.org Jim Rowe

      Hi Derek, I think once you change the xml file you should have all of the standard status’ available in for differentpayment methods. Are you using the standard magento check/money order payment method? Could be that one is special as you probably don’t want to change it to processing until you receive the payment.

      • Derek

        Thanks Jim,

        Your XML changes did provide the full list, and I am using the standard Magento check/MO method. Is there a way to build my own payment method and have more control over how it behaves?

        • http://www.jimcode.org Jim Rowe

          There certainly is – but I have never gone as far as creating my own payment plugin – good luck with this if you manage to get it working. Would be great if you could post any info back on here if it is a success… or if you have any other questions.