开发者

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.


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/)


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜