Пример #1
0
     //primero chequeo si el producto ya existe en el carrito del usuario.
     include_once "includes/class.carrito.php";
     // $carr =  new carrito();
     $x = new tallesColores();
     foreach ($pedido as $k => $v) {
         foreach ($v['talle'] as $kt => $vt) {
             if ((int) $vt > 0) {
                 if (!$x->productExist($id_usuario, $id_producto, $kt, $k)) {
                     $x->usuario = $id_usuario;
                     $x->producto = $id_producto;
                     $x->color = $k;
                     $x->talle = $kt;
                     $x->cantidad = $vt;
                     $x->insert();
                 } else {
                     $x->updateShoppingCartItem($vt, $id_usuario, $id_producto, $kt, $k);
                 }
             }
         }
     }
     @header('location: carrito.php');
 } else {
     //Hay stock
     //No requiere talles
     if ($cantidad_elegida <= $StockActual) {
         $tempMaxCompra->storeSum($id_producto, $cantidad_elegida);
         try {
             $stock = new TempStock();
             $stock->setComunes($id_producto, $cantidad_elegida, $_SESSION['MM_IdUsuario']);
         } catch (Exception $e) {
             echo $e->getMessage();