コード例 #1
0
 function _addProduct($pID, $qty, $old_qty)
 {
     $_SESSION['econda_cart'][] = array('todo' => 'add', 'id' => xtc_db_input($pID), 'cart_qty' => xtc_remove_non_numeric($qty), 'old_qty' => $old_qty);
 }
コード例 #2
0
             $attributes = isset($_POST['id'][$_POST['products_id'][$i]]) ? $_POST['id'][$_POST['products_id'][$i]] : '';
             if (isset($econda) && is_object($econda)) {
                 $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'][$i], $_POST['id'][$i]));
                 $econda->_updateProduct($_POST['products_id'][$i], $cart_quantity, $old_quantity);
             }
             $_SESSION['cart']->add_cart($_POST['products_id'][$i], $cart_quantity, $attributes, false);
             unset($cart_quantity);
         }
     }
     xtc_redirect(xtc_href_link($goto, xtc_get_all_get_params($parameters), 'NONSSL'));
     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_quantity = xtc_remove_non_numeric($_POST['products_qty']) + $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], isset($_POST['id']) ? $_POST['id'] : ''));
         if ($cart_quantity > MAX_PRODUCTS_QTY) {
             $cart_quantity = MAX_PRODUCTS_QTY;
         }
         if (isset($econda) && is_object($econda)) {
             $econda->_emptyCart();
             $old_quantity = $_SESSION['cart']->get_quantity(xtc_get_uprid($_POST['products_id'], isset($_POST['id']) ? $_POST['id'] : ''));
             $econda->_addProduct($_POST['products_id'], $cart_quantity, $old_quantity);
         }
         $_SESSION['cart']->add_cart((int) $_POST['products_id'], $cart_quantity, isset($_POST['id']) ? $_POST['id'] : '');
         //DokuMan - 2012-06-11 - added isset-check for $_POST['id']
     }
     ## PayPal
     include DIR_FS_EXTERNAL . 'paypal/modules/cart_action.php';
     xtc_redirect(xtc_href_link($goto, 'products_id=' . (int) $_POST['products_id'] . '&' . xtc_get_all_get_params($parameters)));
     break;