0

I'm trying to perform some operations on an order if its status/state is "processing" (not sure if I should use status or state here .. any help on this would be great too).

Running a ->getStatus() on a sales/order model tells me the value I'm looking for is "processing", but I don't want to compare this to a string literal. I would like to compare it to the Magento defined value, so I'm wondering how it determines this value "processing" and how can I do the same?

Here is some code..

$order = Mage::getModel('sales/order')->loadByIncrementId($orderID);
if($order->getStatus() == "processing") {
  //do stuff
}

I would like to change "processing" to something like Mage::getModel('sales/order')->STATUS_PROCESSING

I'm sure the answer lies somewhere in the Mage_Sales_Model_Order::getStatus() method, but I'm having a very hard time locating that method. I've even used ReflectionClass to view the methods and do not see it!

Nick Rolando
  • 25,879
  • 13
  • 79
  • 119
  • I don't know exactyl what you are looking for but I did it like this: if ($order->getStatus() === Mage_Sales_Model_Order::STATE_PROCESSING) – Kevin Aug 12 '13 at 19:22

1 Answers1

0

The following code will go off of the Magento status code:

$orders = Mage::getModel('sales/order')->getCollection()
    ->addFieldToFilter('status', 'Processing')
    ;

foreach ($orders as $order) {
    //do stuff
}

I hope that is what you are looking for.