I've separated this from another question I had asked before. How would I be able to filter the sales/order
collection on hasInvoices()
and ensure that there is no balance due to pay? I'd like to avoid doing this in the iteration step and hopefully save performance hits.
$orders = Mage::getModel('sales/order')
->getCollection()
->addAttributeToFilter('status', array('complete','processing'));
foreach ($orders as $order) {
if (($order->hasInvoices()) && ($order->getTotalDue() == 0)) {
echo $order->getIncrementId() . "\n";
}
}
The code above does work, but I think it would be much better to iterate through an already filtered collection.