/** * */ function onHook() { $order_id = modApiFunc("Checkout", "getLastPlacedOrderID"); if ($order_id) { $notifications = modApiFunc("Notifications", "getNotificationsList", 1); foreach ($notifications as $notificationInfo) { $notification = new NotificationContent(array('notification_id' => $notificationInfo['Id'], 'order_id' => $order_id, 'action_id' => 1)); $notification->send(); } } }
/** * */ function onHook($data_obj) { $cr_id = $data_obj->_cr_id_posted; if ($cr_id > 0) { $notifications = modApiFunc('Notifications', 'getNotificationsList', 15); // CustomerReviewPosted foreach ($notifications as $info) { $notification = new NotificationContent(array('notification_id' => $info['Id'], 'cr_id' => $cr_id, 'action_id' => 15)); $notification->send(); } } }
/** * */ function onHook($actionObj) { if (isset($actionObj->result['payment_status']) && sizeof($actionObj->result['payment_status'])) { foreach ($actionObj->result['payment_status'] as $order_id => $statuses) { $order_id = intval($order_id, 10); $notifications = modApiFunc("Notifications", "getNotificationsList", 3); foreach ($notifications as $notificationInfo) { $notification = new NotificationContent(array('notification_id' => $notificationInfo['Id'], 'order_id' => $order_id, 'action_id' => 3, 'status' => 'payment', 'statuses' => $statuses)); $notification->send(); } } } }
/** * */ function onHook($actionObj) { if (isset($actionObj->result['payment_status']) && sizeof($actionObj->result['payment_status'])) { foreach ($actionObj->result['payment_status'] as $order_id => $statuses) { if ($statuses['new_status'] != 2 or $statuses['new_status'] == $statuses['old_status']) { continue; } $order_id = intval($order_id, 10); $notifications = modApiFunc("Notifications", "getNotificationsList", 5); foreach ($notifications as $notificationInfo) { $notification = new NotificationContent(array('notification_id' => $notificationInfo['Id'], 'order_id' => $order_id, 'action_id' => 5)); $notification->send(); } } } }
function OnInventoryLowLevel($inventory_info) { $notifications = modApiFunc("Notifications", "getNotificationsList", 14); //: remove magic number foreach ($notifications as $notificationInfo) { $notification = new NotificationContent(array('notification_id' => $notificationInfo['Id'], 'action_id' => 14, 'inventory_info' => $inventory_info)); $notification->send(); } }