4

Is it possible to get the order state history of an order? I'm able to get the statuses using sales/order_status_history model.

$orderHistory = Mage::getModel('sales/order_status_history')->getCollection()
                ->addFieldToFilter('parent_id', $order->getId());

This only brings back the order status and comment (and a few other bits).

Is there any way I can get the state the order was in for each status? I can't see it stored anywhere other than in the order table but that's the current state.

Thanks in advance.

0

You can get the order status thru the history collection you define, to get the state of a status you can use:

 $statusCollection = Mage::getResourceModel('sales/order_status_collection')
 ->joinStates();

In this collection you can lookup the status and check the assigned state.

  • Thanks. I take it this is just getting the current state and status links? So it wouldn't get what it was at the time of the order? It should be fine as I don't think it has changed. – Paul Jul 10 '13 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.