/** * Check which order notification methods are enabled and trigger each one */ function SendOrderNotifications($pendingOrderToken) { $orders = LoadPendingOrdersByToken($pendingOrderToken); // Firstly, are there any order notification methods that are enabled? $notifications = GetEnabledNotificationModules(); if(!is_array($notifications) || empty($notifications)) { return false; } foreach($notifications as $notifier) { // Instantiate the notification object by reference if(!GetModuleById('notification', $notify_object, $notifier['object']->GetId())) { continue; } // Set the required variables foreach($orders['orders'] as $order) { $notify_object->SetOrderId($order['orderid']); $notify_object->SetOrderTotal($order['total_inc_tax']); $notify_object->SetOrderNumItems($order['ordtotalqty']); $notify_object->SetOrderPaymentMethod($order['orderpaymentmethod']); $response = $notify_object->SendNotification(); if(isset($response['outcome']) && $response['outcome'] == "fail") { $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('notification', $notify_object->_name), GetLang('NotificationOrderError'), $response['message']); } else if(isset($response['outcome']) && $response['outcome'] == "success") { $GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('notification', $notify_object->_name), GetLang('NotificationOrderSuccess'), $response['message']); } } } }
private function ManageNotificationSettings($messages = array()) { $GLOBALS['Message'] = GetFlashMessageBoxes(); $GLOBALS['NotificationJavaScript'] = ""; $GLOBALS['NotificationProviders'] = $this->GetNotificationProvidersAsOptions(); // Which notification modules are enabled? $notifications = GetEnabledNotificationModules(); $GLOBALS['NotificationTabs'] = ""; $GLOBALS['NotificationDivs'] = ""; $count = 2; // Setup each notification module with its own tab foreach ($notifications as $notification) { $GLOBALS['NotificationTabs'] .= sprintf('<li><a href="#" id="tab%d" onclick="ShowTab(%d)">%s</a></li>', $count, $count, $notification['name']); $GLOBALS['NotificationDivs'] .= sprintf('<div id="div%d" style="padding-top: 10px;">%s</div>', $count, $notification['object']->getpropertiessheet($count)); $count++; } $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("settings.notifications.manage"); $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(); }
/** * Check which order notification methods are enabled and trigger each one */ public function _SendOrderNotifications() { // Firstly, are there any order notification methods that are enabled? $notifications = GetEnabledNotificationModules(); if (is_array($notifications) && count($notifications) > 0) { foreach ($notifications as $notifier) { // Instantiate the notification object by reference if (GetModuleById('notification', $notify_object, $notifier['object']->GetId())) { // Set the required variables foreach ($this->pendingData['orders'] as $order) { $query = "\n\t\t\t\t\t\t\t\tSELECT SUM(ordprodqty)\n\t\t\t\t\t\t\t\tFROM [|PREFIX|]order_products\n\t\t\t\t\t\t\t\tWHERE orderorderid='" . (int) $order['orderid'] . "'\n\t\t\t\t\t\t\t"; $numItems = $GLOBALS['ISC_CLASS_DB']->FetchOne($query); $notify_object->SetOrderId($order['orderid']); $notify_object->SetOrderTotal($order['ordtotalamount']); $notify_object->SetOrderNumItems($numItems); $notify_object->SetOrderPaymentMethod($order['orderpaymentmethod']); $response = $notify_object->SendNotification(); if (isset($response['outcome']) && $response['outcome'] == "fail") { $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('notification', $notify_object->_name), GetLang('NotificationOrderError'), $response['message']); } else { if (isset($response['outcome']) && $response['outcome'] == "success") { $GLOBALS['ISC_CLASS_LOG']->LogSystemSuccess(array('notification', $notify_object->_name), GetLang('NotificationOrderSuccess'), $response['message']); } } } } } } }