Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento Order State vs. Status

I'm having a fun time figuring out the difference between an order's 'state' versus it's 'status' in Magento.

We have a custom flow set up to send out orders to 3rd party fulfillment and we also have some custom logic to check for potentially fraudulent orders and flag them to be manually approved for shipping by an admin user to go out for fulfillment.

I have added a 'Pending Shipment' status, and an 'OK to Ship' status into my module config like so:

<global>
    ...
    <sales>
        <order>
            <statuses>
                <pending_shipment translate="label"><label>Pending Shipment</label></pending_shipment>
                <ok_to_ship translate="label"><label>OK To Ship</label></ok_to_ship>
            </statuses>
            <states>
                <processing translate="label">
                    <statuses>
                        <pending_shipment />
                    </statuses>
                </processing>
                <payment_review translate="label">
                    <statuses>
                        <ok_to_ship />
                    </statuses>
                </payment_review>
            </states>
        </order>
    </sales>
    ...
</global>

...and I use the built in 'Suspected Fraud' status for all of this. The problem is that the 'Suspected Fraud' status is grouped under the state 'Payment Review', and if an order is marked 'Suspected Fraud' or 'Payment Review', the admin doesn't allow you the choice of any other statuses besides those 2. Ideally the 'OK To Ship' option would be available, but grouped under the 'state' of 'Processing'. Here, I have 'OK To Ship' under the 'payment_review' state and it made the option available, but then when I pull down an order and check canShip() -- it fails because it's a 'Payment Review' state status.

So if anyone can help me understand how states/statuses are intended to work in Magento and how best to configure this situation, I would appreciate it.

like image 780
Chris Forrette Avatar asked Nov 13 '10 02:11

Chris Forrette


People also ask

What is the difference between state and status in Magento 2?

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.

What is order status in Magento 2?

Magento has the following pre-defined states: New, Pending Payment, Processing, Complete, Closed, Canceled, On Hold, Payment Review. Also, there is a number of pre-defined order statuses, like Processing, Pending Payment, Suspected Fraud, Payment Review, Pending, On Hold, Complete, Closed, Canceled, Pending PayPal.

How do I change my order status in Magento 2?

To change order status in Magento 2: Go to Catalog > Products and check all Products which statuses you want to change. Choose Change Status option іn Actions dropdown, and accordingly, the Order Status you want selected orders to have.

What RMA stands for in Magento 2?

RMA is the abbreviation of the term Return Merchandise Authorization that allows buyers to have a right to return, repair, or replace the products they already purchased in exchange for a refund or credit.


2 Answers

Just to point out that since Magento allowed editing statuses from admin interface (1.5 version I believe), XML statuses configuration has become deprecated. Now the only relevant configuration is inside sales_order_status and sales_order_status state tables.

If you want to add new ones just edit the tables trough phpmyadmin (you can also do it programmaticaly trough installer script http://www.techytalk.info/programmatically-add-new-order-state-and-status-in-magento/)

like image 66
Marko Avatar answered Oct 05 '22 08:10

Marko


My understanding is that for a given state (which are determined by the normal order flow, and aren't really mutable), you have free reign to change the status for the order (which is a label). Depending on what you want to accomplish, could you try cloning <okay_to_ship /> into the other state you want them in? They don't appear to be exclusive.

Thanks, Joe

like image 35
Joe Mastey Avatar answered Oct 05 '22 07:10

Joe Mastey