2

I can use this to get orders with status: complete, processing, closed.

$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter(
    array('status'), 
    array(
        array(
            array('eq' => 'complete'),
            array('eq' => 'processing'),
            array('eq' => 'pending_payment'),
            array('eq' => 'canceled'),
        ),
    )
);

However it doesn't return orders that are pending payment or canceled. How do I get the orders that are pending payment or canceled as well?

3

You can use the below code :

$orders = Mage::getModel('sales/order')->getCollection()
        ->addFieldToFilter('status', array('in' => array('complete','processing','pending_payment','canceled')));

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.