hasStarted() === FALSE ) $session->start();
// if the customer is not logged on, redirect them to the shopping cart page
if (!isset($_SESSION['customer_id'])) {
oos_redirect(oos_href_link($aContents['shopping_cart']));
}
require_once MYOOS_INCLUDE_PATH . '/includes/languages/' . $sLanguage . '/checkout_success.php';
if ( isset($_POST['action']) && ($_POST['action'] == 'notify_process') &&
( isset($_SESSION['formid']) && ($_SESSION['formid'] == $_POST['formid'])) ){
if (isset($_POST['notify']) && !empty($_POST['notify'])) {
$notify = $_POST['notify'];
if (!is_array($notify)) {
$notify = array($notify);
}
$products_notificationstable = $oostable['products_notifications'];
for ($i=0, $n=count($notify); $i<$n; $i++) {
$sql = "SELECT COUNT(*) AS total
FROM $products_notificationstable
WHERE products_id = '" . intval($notify[$i]) . "'
AND customers_id = '" . intval($_SESSION['customer_id']) . "'";
$check = $dbconn->Execute($sql);
if ($check->fields['total'] < 1) {
$today = date("Y-m-d H:i:s");
$sql = "INSERT INTO $products_notificationstable
(products_id,
customers_id,
date_added) VALUES (" . $dbconn->qstr($notify[$i]) . ','
. $dbconn->qstr($_SESSION['customer_id']) . ','
. $dbconn->DBTimeStamp($today) . ")";
$result = $dbconn->Execute($sql);
}
}
}
oos_redirect(oos_href_link($aContents['home']));
}
// links breadcrumb
$oBreadcrumb->add($aLang['navbar_title_1']);
$oBreadcrumb->add($aLang['navbar_title_2']);
$customers_infotable = $oostable['customers_info'];
$sql = "SELECT global_product_notifications
FROM $customers_infotable
WHERE customers_info_id = '" . intval($_SESSION['customer_id']) . "'";
$global_result = $dbconn->Execute($sql);
$global = $global_result->fields;
if ($global['global_product_notifications'] != '1') {
$orderstable = $oostable['orders'];
$sql = "SELECT orders_id
FROM $orderstable
WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'
ORDER BY date_purchased desc LIMIT 1";
$orders_result = $dbconn->Execute($sql);
$orders = $orders_result->fields;
$products_array = array();
$orders_productstable = $oostable['orders_products'];
$sql = "SELECT products_id, products_name
FROM $orders_productstable
WHERE orders_id = '" . intval($orders['orders_id']) . "'
ORDER BY products_name";
$products_result = $dbconn->Execute($sql);
while ($products = $products_result->fields) {
$products_array[] = array('id' => $products['products_id'],
'text' => $products['products_name']);
$products_result->MoveNext();
}
}
$aTemplate['page'] = $sTheme . '/page/checkout_success.html';
$nPageType = OOS_PAGE_TYPE_CHECKOUT;
$sPagetitle = $aLang['heading_title'] . ' ' . OOS_META_TITLE;
require_once MYOOS_INCLUDE_PATH . '/includes/system.php';
if (!isset($option)) {
require_once MYOOS_INCLUDE_PATH . '/includes/message.php';
require_once MYOOS_INCLUDE_PATH . '/includes/blocks.php';
}
//ICW ADDED FOR ORDER_TOTAL CREDIT SYSTEM - Start Addition
$coupon_gv_customertable = $oostable['coupon_gv_customer'];
$sql = "SELECT amount
FROM $coupon_gv_customertable
WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'";
$gv_amount = $dbconn->GetOne($sql);
$smarty->assign('gv_amount', $gv_amount);
$products_notify = '';
if ($global['global_product_notifications'] != '1') {
$products_notify .= $aLang['text_notify_products'] . '
';
$products_displayed = array();
for ($i=0, $n=count($products_array); $i<$n; $i++) {
if (!in_array($products_array[$i]['id'], $products_displayed)) {
$products_notify .= oos_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '
';
$products_displayed[] = $products_array[$i]['id'];
}
}
$products_notify .= '