At the moment I have this code:
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('state',array(array('like'=>'processing')));
Is there a way to add a filter to getCollection() to also filter the orders by payment method or description? something along the lines of:
$orders = Mage::getModel('sales/order')->getCollection()
->addFieldToFilter('state',array(array('like'=>'processing')))
->addFieldToFilter('method',array(array('nlike'=>'paypal')));
If it is only possible by using the filter on single orders, how would i go about doing that? This doesnt seem to work:
$invoices = Mage::getModel('sales/order')->loadByIncrementId($parentOrderNr)
->addFieldToFilter('method',array(array('nlike'=>'paypal')));
Best Answer
You need to append the
sales_flat_order_payment
table to collection: