echo $e->getMessage(); } $id_usuario = $_SESSION['MM_IdUsuario']; //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) { $x->usuario = $_SESSION['MM_IdUsuario']; $x->producto = $id_producto; $x->color = $k; $x->talle = $kt; $x->cantidad = $vt; $x->insert(); } } } @header('location: carrito.php'); exit; } else { $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(); } //Hay stock //No requiere talles