'; // exit; // // // // Check # of cart items for non-member // // // if ( $_POST['action_type'] == 'ajax_cart' || $_POST['action_type'] == 'set_item' || $_GET['action'] == 'add_update_product' ) { // if ( !nsSession_IsRegistered('customer_id') ) { // $cart_query = nsDB_Query("SELECT COUNT( * ) AS cart_items FROM customers_basket WHERE customers_id=0 AND session_id='" . nsSession_ID() . "'"); // $cart_values = nsDB_FetchArray($cart_query); // // if ( intval($cart_values['cart_items']) >= MAX_ALLOWED_CART_ITEMS ) { // $nsCart->SetError('Exceed max allowed cart items for non-members'); // header('Location: ' . nsAPI_GetUrl($goto, nsAPI_GetUrlParams($parameters), 'NONSSL')); // nsAPI_Exit(); // } // } // } if ($_POST['action_type'] == 'ajax_cart') { // customer wants to update the product quantity in their shopping cart $nsCart->AffectedReset(); if (is_array($_POST['products_id']) && is_array($_POST['cart_quantity'])) { for ($i = 0; $i < sizeof($_POST['products_id']); $i++) { if (intval($_POST['cart_quantity'][$i])) { $attributes = $_POST['id'][$_POST['cart_id'][$i]] ? $_POST['id'][$_POST['cart_id'][$i]] : ''; $specials = $_POST['specials'][$_POST['cart_id'][$i]] ? $_POST['specials'][$_POST['cart_id'][$i]] : ''; $nsCart->SetItem($_POST['cart_id'][$i], $_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, $_POST['categories_id'][$i], $_POST['registries_id'][$i], $specials); } } } else { if (preg_match('/^[0-9]+$/', $_POST['products_id'])) { $nsCart->SetItem($_POST['cart_id'], $_POST['products_id'], $_POST['cart_quantity'], $_POST['id'], $_POST['categories_id'], $_POST['registries_id'], $_POST['specials']); } } $nsCart->cleanup(); // nsDB_Query("OPTIMIZE TABLE customers_basket, customers_basket_attributes"); // re-apply coupon if (isset($nsCoupon->_cCode)) { $couponArray = $nsCoupon->GetInfo($nsCoupon->_cCode, $nsCart->GetValidTotalAmount('Coupon', $nsCoupon->_cCode)); $type = ($couponArray['type'] == '0' ? 'A' : 'P'); if ($couponArray !== false && $nsCoupon->Expired() !== true && $nsCoupon->Eligible($_SESSION['customer_id']) === true && $nsCoupon->Redeemed($_SESSION['customer_id']) !== true) { if ($nsCart->SetDiscount('Coupon', $couponArray['type'], $couponArray['code'], $couponArray['amount']) !== false) { // nothing to do } } } } elseif ($_POST['action_type'] == 'set_item' || $_GET['action'] == 'add_update_product') { // customer wants to update the product quantity in their shopping cart $nsCart->AffectedReset(); if (is_array($_POST['products_id']) && is_array($_POST['cart_quantity'])) { /***** original for single for ($i = 0; $i < sizeof($_POST['products_id']); $i++) { $attributes = $_POST['id'][$_POST['cart_id'][$i]] ? $_POST['id'][$_POST['cart_id'][$i]] : ''; $specials = $_POST['specials'][$_POST['cart_id'][$i]] ? $_POST['specials'][$_POST['cart_id'][$i]] : ''; $nsCart->SetItem($_POST['cart_id'][$i], $_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, $_POST['categories_id'][$i], $_POST['registries_id'][$i], $specials); } *****/ /***** for multiple input *****/ for ($i = 0; $i < sizeof($_POST['products_id']); $i++) { $cart_id = $_POST['cart_id'][$i]; if (strlen($_POST['id'][$cart_id]) && strpos($cart_id, '_') !== FALSE) { // clear real key for insertion $_POST['cart_id'][$i] = ''; } $attributes = $_POST['id'][$cart_id]; $specials = $_POST['specials'][$cart_id] ? $_POST['specials'][$cart_id] : ''; $nsCart->SetItem($_POST['cart_id'][$i], $_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, $_POST['categories_id'][$i], $_POST['registries_id'][$i], $specials); } } else { if (preg_match('/^[0-9]+$/', $_POST['products_id'])) { $nsCart->SetItem($_POST['cart_id'], $_POST['products_id'], $_POST['cart_quantity'], $_POST['id'], $_POST['categories_id'], $_POST['registries_id'], $_POST['specials']); } } $nsCart->cleanup(); // nsDB_Query("OPTIMIZE TABLE customers_basket, customers_basket_attributes"); // re-apply coupon if (isset($nsCoupon->_cCode)) { $couponArray = $nsCoupon->GetInfo($nsCoupon->_cCode, $nsCart->GetValidTotalAmount('Coupon', $nsCoupon->_cCode), $_POST['products_id']); $type = ($couponArray['type'] == '0' ? 'A' : 'P'); if ($couponArray === false) { // clear invalid coupon $nsCart->ResetDiscount(); $nsCoupon->Init(); //ZZ $nsCart->SetDiscount('Coupon', $couponArray['type'], $nsCoupon->_cCode); } elseif ($couponArray !== false && $nsCoupon->Expired() !== true && $nsCoupon->Eligible($_SESSION['customer_id']) === true && $nsCoupon->Redeemed($_SESSION['customer_id']) !== true) { if ( $nsCoupon->getValidProductCount() > 0 ) { if ($nsCart->SetDiscountProduct('Coupon', $couponArray['type'], $nsCoupon) !== false) { // nothing to do } } else { if ($nsCart->SetDiscount('Coupon', $couponArray['type'], $couponArray['code'], $couponArray['amount']) !== false) { // nothing to do } } } } if ($_GET['action'] == 'add_update_product') { header('Location: ' . nsAPI_GetUrl($goto, nsAPI_GetUrlParams($parameters), 'NONSSL')); nsAPI_Exit(); } } elseif ($_GET['action'] == 'remove_product') { // customer wants to remove a product from their shopping cart $nsCart->RemoveItem($_GET['cart_id']); $nsCart->SetDiscount('Coupon'); $couponArray = $nsCoupon->GetInfo($nsCoupon->_cCode, $nsCart->GetValidTotalAmount('Coupon', $nsCoupon->_cCode), $nsCart->GetIndexArray()); $type = ($couponArray['type'] == '0' ? 'A' : 'P'); //ZZZ if ($couponArray !== false && $nsCoupon->Expired() !== true && $nsCoupon->Redeemed($_SESSION['customer_id']) !== true) { if ($couponArray !== false && $nsCoupon->Exceed() !== true && $nsCoupon->Eligible($_SESSION['customer_id']) === true && $nsCoupon->Expired() !== true) { if( $nsCoupon->getValidProductCount() > 0 ) { if ($nsCart->SetDiscountProduct('Coupon', $couponArray['type'], $nsCoupon) !== false) { // nothing to do } } else { if ($nsCart->SetDiscount('Coupon', $couponArray['type'], $couponArray['code'], $couponArray['amount']) !== false) { // nothing to do } } } if (strlen($_GET['goto'])) { header('Location: ' . nsAPI_GetUrl($_GET['goto'], nsAPI_GetUrlParams($parameters), 'NONSSL')); nsAPI_Exit(); } } elseif ($_POST['action_type'] == 'remove_all') { // customer wants to remove all products from their shopping cart $nsCart->Init(TRUE); $nsCoupon->Init(); // remove _nsCheckout session unset($_POST['_sessionSET']); unset($_SESSION['_nsCheckout']); unset($_SESSION['_nsCoupon_PCTOFF']); unset($_SESSION['_nsCoupon_TYPE']); //header('Location: ' . nsAPI_GetUrl($goto, '', 'NONSSL')); //nsAPI_Exit(); } elseif ($_POST['action_type'] == 'set_coupon') { // $_couponPCT = new nsCoupon; $nsCoupon->Init(); $nsCoupon->GetInfoByID( 1, $nsCart->GetIndexArray() ); if( $nsCoupon->Expired() !== true && strtoupper( $_POST['coupon_code'] ) == strtoupper($nsCoupon->_cCode) ) { $_SESSION['_nsCoupon_PCTOFF'] = 'YES'; $_SESSION['_nsCoupon_TYPE'] = '1'; } else { $nsCoupon->GetInfoByID( 2, $nsCart->GetIndexArray() ); if( $nsCoupon->Expired() !== true && strtoupper( $_POST['coupon_code'] ) == strtoupper($nsCoupon->_cCode) ) { $_SESSION['_nsCoupon_PCTOFF'] = 'YES'; $_SESSION['_nsCoupon_TYPE'] = '2'; } else { $couponArray = $nsCoupon->GetInfo($_POST['coupon_code'], $nsCart->GetValidTotalAmount('Coupon', $nsCoupon->_cCode), $_POST['products_id']); $type = ($couponArray['type'] == '0' ? 'A' : 'P'); if ($couponArray !== false && $nsCoupon->Expired() !== true && $nsCoupon->Eligible($_SESSION['customer_id']) === true && $nsCoupon->Redeemed($_SESSION['customer_id'], YC_GRADE_MIN_ADMIN_LEVEL) !== true) { if ( $nsCoupon->getValidProductCount() > 0 ) { if ($nsCart->SetDiscountProduct('Coupon', $couponArray['type'], $nsCoupon) !== false) { // nothing to do } } else { if ($nsCart->SetDiscount('Coupon', $couponArray['type'], $couponArray['code'], $couponArray['amount']) !== false) { // nothing to do } } } } } } elseif ($_POST['action_type'] == 'remove_discount') { $nsCart->SetDiscount($_GET['discount']); $nsCoupon->Init(); unset($_SESSION['_nsCoupon_PCTOFF']); unset($_SESSION['_nsCoupon_TYPE']); // From Admin Order page } elseif ($_GET['action'] == 'add_to_order' && $_GET['oID']) { if (isset($_SESSION['customer_grade']) && $_SESSION['customer_grade'] <= YC_GRADE_MANAGER) { $_SESSION['_Admin']['oID'] = $_GET['oID']; } } } // calculate category path $cPath = $_GET['cPath']; if (! $cPath) { if ($_GET['products_id']) { $p_query = nsDB_Query("select categories_id as cid from products where products_id='" . $_GET['products_id'] . "'"); $p_values = nsDB_FetchArray($p_query); $cPath = nsAPI_GetCategoriesPath($p_values['cid']); } } if ($cPath) { $cPath_array = explode('_', $cPath); $current_category_depth = sizeof($cPath_array)-1; $current_category_id = $cPath_array[$current_category_depth]; $cInfo_array = nsAPI_GetCategoriesInfo($cPath, TRUE); $cInfo_cursor = $cInfo_array[$current_category_depth]; if ($cInfo_array[$current_category_depth-1]['cid']) { $cInfo_parent = $cInfo_array[$current_category_depth-1]; } $cInfo_top = $cInfo_array[0]; } else { $current_category_id = 0; $current_category_depth = 0; } // manufacturers action if (defined('SYS_MANUFACTURER_SUPPORT') && SYS_MANUFACTURER_SUPPORT) { if (isset($_GET['manufacturers_id']) && intval($_GET['manufacturers_id'])) { $mInfo_array = nsAPI_GetManufacturersInfo($_GET['manufacturers_id'], TRUE); $mInfo_cursor = $mInfo_array[0]; } if (isset($_GET['categories_id']) && intval($_GET['categories_id'])) { $mInfo_cPath = nsAPI_GetCategoriesPath($_GET['categories_id']); $mInfo_cDepth = preg_match_all("/_/", $mInfo_cPath, $dummy); $mInfo_cInfo_array = nsAPI_GetCategoriesInfo($mInfo_cPath, false); $mInfo_cInfo_cursor = $mInfo_cInfo_array[$mInfo_cDepth]; } } /* // gift registry action if (nsSession_IsRegistered('customer_id')) { $regInfo_array = nsAPI_GetRegistriesInfo($_SESSION['customer_id'], TRUE); } // PageView History actions if (!isset($_SESSION['_nsHistory'])) { $_history = new nsHistory; $_SESSION['_nsHistory'] = $_history; } $nsHistory = &$_SESSION['_nsHistory']; $nsHistory->Set(16); */ // featured categories info $featured_categories = array(); if (defined('USE_DISPLAY_HOTBUYS') && USE_DISPLAY_HOTBUYS) $featured_categories['MONTHLY SPECIALS'] = array(FILENAME_FEATURED_HOT, HOTBUYS_CUTOFF_DAYS); if (defined('USE_DISPLAY_NEWITEMS') && USE_DISPLAY_NEWITEMS) $featured_categories['New Arrival'] = array(FILENAME_FEATURED_NEW, NEWITEMS_CUTOFF_DAYS); if (defined('USE_DISPLAY_BESTSELLERS') && USE_DISPLAY_BESTSELLERS) $featured_categories['Best Seller'] = array(FILENAME_FEATURED_BEST, BESTSELLERS_CUTOFF_DAYS); $keep_spel_array = array(); // refer action if (strlen($_GET['refer_key']) > 0) { // check for the 'refer_key' $refer_info = nsDB_Query("select * from products_refer where refer_key='" . $_GET['refer_key'] . "' and refer_status=0"); if (nsDB_NumRows($refer_info)) { setcookie('refer_key', $_GET['refer_key'], time()+(86400*30), '/'); } } // Affiliates action if (isset($_GET['SSAID']) && $_GET['SSAID']) { setcookie('SSAID', $_GET['SSAID'], time()+(86400*60), '/'); } // Checkout Session Control if (sizeof($_POST['_sessionSET'])) { // Save the form values into session for ($i = 0; $i < sizeof($_POST['_sessionSET']); $i++) { $key = $_POST['_sessionSET'][$i]; $_SESSION['_nsCheckout'][$key] = $_POST[$key]; } } if (sizeof($_POST['_sessionINIT'])) { // Remove values from session for ($i = 0; $i < sizeof($_POST['_sessionINIT']); $i++) { $key = $_POST['_sessionINIT'][$i]; unset($_SESSION[$key]); } } // Product Price Control $gPriceColumn = (isset($_SESSION['price_column']) ? $_SESSION['price_column'] : 'p.products_price'); $gPriceColumnAs = 'price_column'; // override options for DEBUG and DEVELOPMENT if (isset($_SESSION['customer_grade']) && $_SESSION['customer_grade'] == YC_GRADE_ADMIN) { define('__IS_ADMIN__', true); } else { define('__IS_ADMIN__', false); } if ((strpos($_SERVER['REMOTE_ADDR'], "71.246.59.") !== false || strpos($_SERVER['REMOTE_ADDR'], "96.247.2.") !== false || strpos($_SERVER['REMOTE_ADDR'], "104.1.51.") !== false) && (isset($_SESSION['customer_grade']) && $_SESSION['customer_grade'] == YC_GRADE_ADMIN) ) { define('__INLINE_CODE__', true); define('__INLINE_DEBUG__', true); define('ENABLE_GUEST_CHECKOUT', false); @ini_set('display_errors', TRUE); // $hLeftMenus->Remove($cfg['LeftMenus']['material']); // $__gEnable_Paypal_ExpressCheckout = true; // $__gEnable_Google_Checkout = true; } else { define('ENABLE_GUEST_CHECKOUT', false); } /* // // User Agent Dection // include_once($cfg['Path']['rs_functions'] . 'nsAgentDetect.php'); $_BROWSER = nsAPI_BrowserDetect('full_assoc'); // $_BROWSER['OS'] = nsAPI_BrowserDetect('os'); */ // // robot Dection // $_searchengines = array( 'Googlebot', 'Slurp', 'search.msn.com', 'nutch', 'simpy', 'bot', 'ASPSeek', 'crawler', 'msnbot', 'Libwww-perl', 'FAST', 'Baidu' ); $_is_robot = false; foreach ($_searchengines as $searchengine) { if (!empty($_SERVER['HTTP_USER_AGENT']) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), strtolower($searchengine)) !== false) { $_is_robot = true; break; } } // // Null Action // $_SCRIPT['NullAction'] = 'href="javascript:jsAPI_Void();"'; $_SCRIPT['NullAnchor'] = 'href="javascript:jsAPI_Void();"'; if (stripos($_SERVER['HTTP_USER_AGENT'], "Firefox") !== false && stripos($_SERVER['HTTP_USER_AGENT'], 'Windows') !== false) { $_SCRIPT['NullAction'] = ''; } if (isset($_SESSION['customer_grade']) && $_SESSION['customer_grade'] <= YC_GRADE_STORE_MANAGER) { $gEventControl = ''; $__gEnable_Estimated_Delivery_Date = false; } else { // $gEventControl = ' oncontextmenu="return false;" '; } ?>'; // // echo '$_BROWSER : ' . "\n"; // print_r($_GET); // print_r($_POST); // // echo '$_SESSION : ' . "\n"; // /// print_r($_SESSION); // echo '
"Total Quality Assurance and Customer Satisfaction" are the central goals of our company. We believe that our industry is one where reliability in long-term use, functionality and cost are all of great importance, but that it is reliability that differentiates the truly superior products. So, every product in the MEAN WELL range is the result of rigid procedures governing design, design verification test (DVT), design quality test (DQT), component selection, pilot-run production, and mass production. Our goal is to offer total solutions that satisfy our customer's requirements. We have earned a good reputation based on the quality, competitive prices and punctual delivery of our products. We have over 5,000 standard models widely used in automation, communication, LED lighting, medical, moving sign, and office automation fields.