Tags/topics: 
2
Answers
Vote up!
2
Vote down!

Difference between "order state" and "order status"

Hi all,

I am trying to make a simple rule that will update an Order's status to "processing" and send me an email when the order is first paid in full. Here's a quick look at what my rule looks like:

Events:
-When an order is paid in full

Conditions:
(None)

Actions:
-Update the order status (Parameter: Order to update: [commerce-order], Order status: Processing)
-Send mail
-Save entity (Parameter: Entity: [commerce-order])

After completing payment, I receive the email, so it appears that the rule is being fired, but the Order's status does not update. I decided to look at the built-in "Update the order status on checkout completion" to see if I could find any clues and noticed that despite the name, this rule actually updates the order *state* rather than the order *status*.

Can anyone shed some light on why this rule does not properly update the Order status? Should I be setting the Order state instead? Any help would be much appreciated.

Asked by: w00zle
on September 6, 2012

2 Answers

Vote up!
2
Vote down!

Hey w00zle,

How did you create the 'Processing' order status? maybe go and have a look if this has been done correctly. Each order status needs to have at least one order state.

The update order status rule is going to set the order state to the default state for the status you have chosen, so this may be falling down if the status doesn't have any active states defined.

Also turn on rules debugging so that you can have a look if the rule is giving any error messages which point you to what is going on. Go to admin/config/workflow/rules/settings and choose the always checkbox under the debugging section.

Cheers
Bernie

Answer by: BernieCram
Posted: Sep 11, 2012

Comments

The order status "Processing" is listed under the order state "Pending". I too am having issues getting the order status to change.

- filmoreha on December 3, 2012
Vote up!
0
Vote down!

Reading this post, as well as the FAQ page "What are order states" (https://drupalcommerce.org/faq/order-states) it is still not entirely clear to me what is the purpose of states and statuses and why do we need to have both?

So my first question is :
1. What is the purpose of states and statuses and why do we need to have both? Status applies to the Order? And State applies to... what..? also the order?

2. Would it be correct to say that instead of the two variables we could have one flat State (or Status) variable with valid values as follows:

State_Canceled
State_Shopping_cart
State_Checkout
State_Checkout_Review
State_Checkout_Payment (indicating the customer has been redirected for payment)
State_Checkout_Complete ---> ??? meaning ???
State_Pending ---> ??? meaning ???
State_Pending_Processing ---> ??? meaning ???
State_Completed

If the above is correct then why do we need 2 variables? I realize that do not know the internals of drupal-commmerce very well, and there may be a very good reason for this... but from a simple Software Engineering point of view it seems like a waste of resource, creating unnecessary dependencies and the need for validity checks (e.g. checks for invalid combinations State=Shopping Cart and <?code>Status=Review which is not valid) and in the end it's simply confusing. So my question is: What defines the need for 2 variables to describe the state of the Order during the processing workflow, instead of just one?

3. The states with the question marks are not self-explanatory (not to me anyway) and they were not explained in the FAQ page... could anybody explain them please or provide a link to some docs where they are explained?

Thanks!

Alexander Enchevich
Posted: Jul 6, 2015