Created
October 20, 2013 08:06
-
-
Save yireo/7066278 to your computer and use it in GitHub Desktop.
Cronjob for Magento to send any order-emails that have not been sent yet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
$from_date = date('Y-m-d', time() - (60*60*24*14)); | |
$orders = Mage::getModel('sales/order')->getCollection() | |
->addAttributeToFilter('created_at', array('from' => $from_date)) | |
->addAttributeToFilter('email_sent', array('null' => true)) | |
; | |
foreach($orders as $order) { | |
if($order->getCanSendNewEmailFlag() != true) continue; | |
if($order->getStatus() != 'canceled') continue; | |
$order->sendNewOrderEmail(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment