示例#1
0
     for ($i = 0, $n = sizeof($HTTP_POST_VARS['products_id']); $i < $n; $i++) {
         if (in_array($HTTP_POST_VARS['products_id'][$i], is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array())) {
             $cart->remove($HTTP_POST_VARS['products_id'][$i]);
         } else {
             $attributes = $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
             $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
         }
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
 // customer adds a product from the products page
 case 'add_product':
     if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
         $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
         $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes)) + 1, $attributes);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer removes a product from their shopping cart
 // customer removes a product from their shopping cart
 case 'remove_product':
     if (isset($HTTP_GET_VARS['products_id'])) {
         $cart->remove($HTTP_GET_VARS['products_id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // performed by the 'buy now' button in product listings and review page
 // performed by the 'buy now' button in product listings and review page
 case 'buy_now':
     if (isset($HTTP_GET_VARS['products_id'])) {
             $cart->remove($HTTP_POST_VARS['products_id'][$i]);
         } else {
             $attributes = $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
             $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
         }
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
     // Additional code to allow sample quantity  - BBG Design 2011
 // customer adds a product from the products page
 // Additional code to allow sample quantity  - BBG Design 2011
 case 'add_product':
     if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id']) && $HTTP_POST_VARS['cart_quantity'] != '0') {
         $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
         $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']);
     } elseif (isset($HTTP_POST_VARS['products_sample_code']) && is_numeric($HTTP_POST_VARS['products_sample_code']) && $HTTP_POST_VARS['cart_quantity2'] != '0') {
         $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
         $cart->add_cart($HTTP_POST_VARS['products_sample_code'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_sample_code'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity2'], $HTTP_POST_VARS['id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer removes a product from their shopping cart
 // customer removes a product from their shopping cart
 case 'remove_product':
     if (isset($HTTP_GET_VARS['products_id'])) {
         $cart->remove($HTTP_GET_VARS['products_id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // performed by the 'buy now' button in product listings and review page
             $quantity = (int) $HTTP_POST_VARS['quantity'];
             if (isset($HTTP_GET_VARS['products_id'])) {
                 $products_id = $HTTP_GET_VARS['products_id'];
             } else {
                 $products_id = $HTTP_POST_VARS['products_id'];
             }
             if ($quantity < 1) {
                 $quantity = 1;
             }
             if ($HTTP_GET_VARS['to'] == 'foreign') {
                 $foreign_cart->add_cart($products_id, 1);
             } elseif ($HTTP_GET_VARS['to'] == 'postpone') {
                 $postpone_cart->add_cart($products_id, 1);
                 $cart->remove($products_id);
             } else {
                 $quantity = $cart->get_quantity($products_id) + $quantity;
                 $cart->add_cart($products_id, $quantity);
                 $postpone_cart->remove($products_id);
             }
         }
         tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters), $ssl_params) . '#' . $HTTP_GET_VARS['to']);
     } else {
         $messageStack->add_session('header', ENTRY_GUEST_ADD_TO_CART_ERROR);
         tep_redirect($_SERVER['HTTP_REFERER']);
     }
     break;
     // customer reset a cart
 // customer reset a cart
 case 'reset_cart':
     if ($HTTP_GET_VARS['cart_type'] == 'postpone') {
         $postpone_cart->reset(true);
示例#4
0
                     }
                 }
                 $attributes = $id2[$HTTP_POST_VARS['products_id'][$i]] ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
             } else {
                 $attributes = $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
             }
             $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
         }
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
 // customer adds a product from the products page
 case 'add_product':
     if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
         $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + 1, $HTTP_POST_VARS['id']);
     }
     if (isset($HTTP_POST_VARS['gift_id']) && is_numeric($HTTP_POST_VARS['gift_id'])) {
         $cart->add_cart($HTTP_POST_VARS['gift_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['gift_id'], $HTTP_POST_VARS['id'])) + 1, $HTTP_POST_VARS['id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // performed by the 'buy now' button in product listings and review page
 // performed by the 'buy now' button in product listings and review page
 case 'buy_now':
     if (isset($HTTP_GET_VARS['products_id'])) {
         if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
             tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
         } else {
             $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id']) + 1);
         }
 case 'update_product':
     for ($i = 0, $n = sizeof($_POST['products_id']); $i < $n; $i++) {
         if ($store_registered && in_array($_POST['products_id'][$i], is_array($_POST['cart_delete']) ? $_POST['cart_delete'] : array())) {
             $cart->remove($_POST['products_id'][$i]);
         } else {
             $attributes = $_POST['id'][$_POST['products_id'][$i]] ? $_POST['id'][$_POST['products_id'][$i]] : '';
             $cart->add_cart($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, false);
         }
     }
     smn_redirect(smn_href_link($goto, smn_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
 // customer adds a product from the products page
 case 'add_product':
     if ($store_registered && isset($_POST['products_id'])) {
         $cart->add_cart($_POST['products_id'], $cart->get_quantity(smn_get_prid(smn_get_uprid($_POST['products_id'], $_POST['id']))) + 1, $_POST['id']);
     }
     smn_redirect(smn_href_link($goto, smn_get_all_get_params($parameters)));
     break;
     // performed by the 'buy now' button in product listings and review page
 // performed by the 'buy now' button in product listings and review page
 case 'buy_now':
     if ($store_registered && isset($_GET['products_id'])) {
         if (smn_has_product_attributes($_GET['products_id'])) {
             smn_redirect(smn_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']));
         } else {
             $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id']) + 1);
         }
     }
     smn_redirect(smn_href_link($goto, smn_get_all_get_params($parameters)));
     break;
                     }
                 }
                 $attributes = $id2[$_POST['products_id'][$i]] ? $id2[$_POST['products_id'][$i]] : '';
             } else {
                 $attributes = $_POST['id'][$_POST['products_id'][$i]] ? $_POST['id'][$_POST['products_id'][$i]] : '';
             }
             $cart->add_cart($_POST['products_id'][$i], $_POST['cart_quantity'][$i], $attributes, false);
         }
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
 // customer adds a product from the products page
 case 'add_product':
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id'])) + 1, $_POST['id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds a product from the products page
 // customer adds a product from the products page
 case 'add_multiple_products':
     if (isset($_POST['products_id']) && is_array($_POST['products_id'])) {
         foreach ($_POST['products_id'] as $ids) {
             if (substr($ids, 0, 1) == '_') {
                 $ids = substr($ids, 1);
                 $cart->add_cart($ids, $cart->get_quantity(tep_get_uprid($ids, $_POST['id'])) + 1, $_POST['id']);
             } else {
                 if (strstr($ids, '{') && strstr($ids, '}')) {
                     $options = explode('{', $ids);
                     $prodId = $options[0];
示例#7
0
             $attrlist = explode(',', $_POST['attrcomb']);
             foreach ($attrlist as $attr) {
                 list($oid, $oval) = explode('-', $attr);
                 if (is_numeric($oid) && $oid == (int) $oid && is_numeric($oval) && $oval == (int) $oval) {
                     $attributes[$oid] = $oval;
                 }
             }
         }
         if (isset($_POST['id']) && is_array($_POST['id'])) {
             foreach ($_POST['id'] as $key => $val) {
                 if (is_numeric($key) && $key == (int) $key && is_numeric($val) && $val == (int) $val) {
                     $attributes = $attributes + $_POST['id'];
                 }
             }
         }
         $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $attributes)) + $_POST['cart_quantity'], $attributes);
         // EOF: MOD - QT Pro
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // performed by the 'buy now' button in product listings and review page
 // performed by the 'buy now' button in product listings and review page
 case 'buy_now':
     if (isset($_GET['product_to_buy_id'])) {
         if (tep_has_product_attributes($_GET['product_to_buy_id'])) {
             tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['product_to_buy_id'] . '&opts=1'));
         } else {
             $cart->add_cart($_GET['product_to_buy_id'], $cart->get_quantity($_GET['product_to_buy_id']) + 1);
             tep_redirect(tep_href_link($goto, 'products_id=' . $_GET['products_id']));
         }
     } elseif (isset($_GET['products_id'])) {
示例#8
0
             $attrlist = explode(',', $_POST['attrcomb']);
             foreach ($attrlist as $attr) {
                 list($oid, $oval) = explode('-', $attr);
                 if (is_numeric($oid) && $oid == (int) $oid && is_numeric($oval) && $oval == (int) $oval) {
                     $attributes[$oid] = $oval;
                 }
             }
         }
         if (isset($_POST['id']) && is_array($_POST['id'])) {
             foreach ($_POST['id'] as $key => $val) {
                 if (is_numeric($key) && $key == (int) $key && is_numeric($val) && $val == (int) $val) {
                     $attributes = $attributes + $_POST['id'];
                 }
             }
         }
         $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $attributes)) + 1, $attributes);
         //++++ QT Pro: End Changed Code
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // BOC Column List View
 // BOC Column List View
 case 'buy_now_form':
     if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) {
         $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id'])) + $_POST['cart_quantity'], $_POST['id']);
         // replace quantities         $cart->get_quantity($_POST['products_id'])-($cart->get_quantity($_POST['products_id']))+($_POST['cart_quantity']), $_POST['id']);
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // customer adds multiple products from the products_listing page
 // customer adds multiple products from the products_listing page
示例#9
0
             foreach ($attrlist as $attr) {
                 list($oid, $oval) = explode('-', $attr);
                 if (is_numeric($oid) && $oid == (int) $oid && is_numeric($oval) && $oval == (int) $oval) {
                     $attributes[$oid] = $oval;
                 }
             }
         }
         if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
             foreach ($HTTP_POST_VARS['id'] as $key => $val) {
                 if (is_numeric($key) && $key == (int) $key && is_numeric($val) && $val == (int) $val) {
                     $attributes = $attributes + $HTTP_POST_VARS['id'];
                 }
             }
         }
         //print_r($attributes);
         $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes)) + 1, $attributes);
         //++++ QT Pro: End Changed Code
     }
     if ($AJAX) {
         exit;
     }
     tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
     break;
     // BOF: Product Listing in Columns
     // add to cart
     // customer adds a product from the products page
 // BOF: Product Listing in Columns
 // add to cart
 // customer adds a product from the products page
 case 'add_product_cs':
     if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {