Apr 21, 2012
kalpesh

Magento: Difference between order states and statuses

If you are building website in Magento, you may have noticed that there are two columns in sales_flat_order table which are confusing. These are state and status. You might think what is the difference between these two, both having same meaning.

Well, this is not the case. They both are different. State is used by magento to tell if the order is new, processing, complete, holded, closed, canceled, etc.; while Statuses are the one that YOU would be defining at the backend in System -> Order Statuses. Magento displays order STATUSES and not STATES in the backend order detail page to let you know which status is assigned as per your mapping. Remember, multiple statuses can be mapped with one state, while vice versa is not possible.

Consider an example, your customer places an order as Cash on Delivery, you will need something like COD_Pending as the order status so that you know it is not yet paid. Magento will have state new for this, which makes you unpredictable of what kind of transaction is this, COD or Prepaid. The STATUS can be anything, as you define, for your understanding; while STATE is something which Magento needs to understand, internally.

In short, Magento uses order state internally for processing order, whereas order status are used by store owners to understand the exact order flow where one state can be assigned to multiple statuses.

To understand this in detail, have a look at this
Hope it helps!

7 Comments

  • Kalpesh,
    Thanks for the blogpost.

    I am using EBS Payment gateway. Irrespective of whether the payment is successful or not, the order gets placed. Is there a way to handle this problem.

    Thanks

    • Hi Raghuram. Even if payment fails, order will get placed. You can’t do much with this as this is the core functionality and also the accepted standard. Considering your view, guess the payment is successful and Magento was unable to place the order, then where would it reflect the payment? You will not have any track of order and customer is out of his items even he has been charged.

  • Kalpesh,

    i have similar issue as raghuram, but it has two more additions to it. i am using magento ce 1.6.

    1. Even if the payment is successful, shopping cart does not get empty. ( persistent shopping cart is enabled)
    2. When i am creating order from backed, no payment method shows and hence can’t create order from backend.

    Do you think this can implementation issue of EBS payment gateway. i have it check from developer, but he says its all fine.

    thanks

    • Ankur, second issue is due to Billdesk, first you need to dig it out.
      If you disable persistent shopping cart, then may be you can get rid of first issue. If you don’t want to do that, check below.
      1. It means your quote object is still active. May be you need to inactive it when order is placed through some observer, though it should be done automatically.
      2. In your payment method Model file, just change $_canUseInternal value to true, it means you can now see the payment method in admin panel also.

  • but this is creating a big problem in magento when it creates order even if the payment is not sucessful there must be a way to get rid of it.

    Second issue is this that when customer places order using Cash on delivery and Admin cancels the order, after cancelling the order order shows the amount due to customer.
    When in COD i have not received the amount how it can show the amount due

  • Thanks a lot. Am just getting started with magento, this helps.

  • it has given clear understood of state and status but still confusing me while working on this. If you have time please visit the below link and suggest what I did wrong.
    http://magento.stackexchange.com/questions/111855/choose-order-state-and-status-magento-2
    Thanks

Leave a comment

 

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications

Honor

Recognition

Magento top 50 contributors

Magento top 50 contributors

Contributions