set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } // needs to be included earlier to set the success message in the messageStack require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_NOTIFICATIONS); $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'"); $global = tep_db_fetch_array($global_query); if (isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process')) { if (isset($HTTP_POST_VARS['product_global']) && is_numeric($HTTP_POST_VARS['product_global'])) { $product_global = tep_db_prepare_input($HTTP_POST_VARS['product_global']); } else { $product_global = '0'; } (array)$products = $HTTP_POST_VARS['products']; if ($product_global != $global['global_product_notifications']) { $product_global = (($global['global_product_notifications'] == '1') ? '0' : '1'); tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set global_product_notifications = '" . (int)$product_global . "' where customers_info_id = '" . (int)$customer_id . "'"); } elseif (sizeof($products) > 0) { $products_parsed = array(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { if (is_numeric($products[$i])) { $products_parsed[] = $products[$i]; } } if (sizeof($products_parsed) > 0) { $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")"); $check = tep_db_fetch_array($check_query); if ($check['total'] > 0) { tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "' and products_id not in (" . implode(',', $products_parsed) . ")"); } } } else { $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['total'] > 0) { tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'"); } } $messageStack->add_session('account', SUCCESS_NOTIFICATIONS_UPDATED, 'success'); tep_redirect(tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); } $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL')); ?> > <?php echo TITLE; ?>
 
0) { ?>
' . tep_image_button('button_back.gif', IMAGE_BUTTON_BACK) . ''; ?>