How to define the order status after creating an invoice

The question:

I have searched a lot with google but somehow I’m using the wrong search terms or there is no answer to my specific problem yet.

In Magento I’d like to have the following procedure:
Customer creates an order, I generate an invoice (Status switches to payment_review or something like that), I send out the order (Status switches to completed).

Currently after creating the invoice the status automatically switches to completed.

So how do I say what status is used after generating the invoice?

Thanks for suggestions

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

The easiest way to think about how Magento processes all the orders is first knowing that Magento uses an internal order state and a status.

States:

  • new: This order is new, unprocessed, not picked up by the payment gateway or anything.
  • pending_payment: Payment is being processed by the payment gateway (this should always automatically resolve if the gateway is set up correctly/is build correctly). Inventory is already reduced.
  • processing: Invoice has been created, order is ready to be processed
  • complete: Shipment is made, downloads or giftcard have been mailed.
  • closed: Order is closed before the invoice has been created. Inventory is returned to stock
  • canceled: Credit memo has been made.
  • holded: Manual state so you can hold or unhold the order.
  • payment_review: Integration with the payment gateway, sometimes a payment has to be reviewed (when a payment is suspected of fraud, PayPal uses this for example).

States in the code: https://github.com/LokeyCoding/magento-mirror/blob/magento-1.8/app/code/core/Mage/Sales/Model/Order.php#L333

Statuses

Each state in Magento can be mapped to multiple statuses. The statuses is what you can define your self (http://www.magentocommerce.com/knowledge-base/entry/custom-order-status) and you can set a certain status to be the default status.

Magento order statuses

Payment gateways, connections with other systems usually have the ability to set the status to something different than set by default. Payment gateways sometimes introduce new statuses and use those instead of the default.

Your situation

In Magento I’d like to have the following procedure: Customer creates an order, I generate an invoice (Status switches to payment_review or something like that), I send out the order (Status switches to completed).

Option 1: Normally when an invoice is created (and no shipment is created) it sets the state to processing and the status to the default status (or some other status if that is set in the payment method).

Option 2: If the shipment is already created or if we are talking about virtual products (gift cards or downloadable products or other virtual products) the state switches to complete and the status to de selected default status (by default also complete).

Currently after creating the invoice the status automatically switches to completed.

It seems we are talking about option 2 here, that means that the order is completely processed. If you wish to do something else with the order after that (maybe you need to do a follow up), you can create a new default status for the complete state and it will automatically switch to that status.

I hope this makes sense.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment