I have the following code, if there are no orders older then $days_ago
no orders older then $days_ago
, I want that the foreach
foreach
loop won't be executed. I don't know how to do this.
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToSelect('*')
->addAttributeToFilter('created_at', array('lt' => $days_ago));
foreach ($orders as $order):
if(!$this->_shouldBeAnonymised($order)):
continue;
endif;
$this->_anonymiseSale($order);
endforeach;
Hope someone can help me!