/** * Remove orders that have not been completed for a given number of days */ public function deleteOldOrders() { $t = Order::getTable(); $objOrders = Order::findBy(array("{$t}.order_status=0", "{$t}.tstamp<?"), array(time() - $GLOBALS['TL_CONFIG']['iso_orderTimeout'])); if (($intPurged = $this->deleteOldCollections($objOrders)) > 0) { \System::log('Deleted ' . $intPurged . ' incomplete orders', __METHOD__, TL_CRON); } }
/** * Generate the module * @return void */ protected function compile() { $arrOrders = array(); $objOrders = Order::findBy(array('order_status>0', 'member=?', 'config_id IN (?)'), array(\FrontendUser::getInstance()->id, implode("','", $this->iso_config_ids)), array('order' => 'locked DESC')); // No orders found, just display an "empty" message if (null === $objOrders) { $this->Template = new \Isotope\Template('mod_message'); $this->Template->type = 'empty'; $this->Template->message = $GLOBALS['TL_LANG']['ERR']['emptyOrderHistory']; return; } while ($objOrders->next()) { Isotope::setConfig($objOrders->current()->getRelated('config_id')); $arrOrders[] = array('collection' => $objOrders->current(), 'raw' => $objOrders->current()->row(), 'date' => Format::date($objOrders->current()->locked), 'time' => Format::time($objOrders->current()->locked), 'datime' => Format::datim($objOrders->current()->locked), 'grandTotal' => Isotope::formatPriceWithCurrency($objOrders->current()->getTotal()), 'status' => $objOrders->current()->getStatusLabel(), 'link' => $this->jumpTo ? \Haste\Util\Url::addQueryString('uid=' . $objOrders->current()->uniqid, $this->jumpTo) : '', 'class' => $objOrders->current()->getStatusAlias()); } RowClass::withKey('class')->addFirstLast()->addEvenOdd()->applyTo($arrOrders); $this->Template->orders = $arrOrders; }