<?php 
} else {
    $carro = $carrito->get_content();
    if ($carro) {
        ?>
<div class="table_carro">
                <table class="table tabla_cambios">
                <th>Imagen</th>
                <th>Nombre</th>
                <th>Talla</th>
                <th>Cantidad</th>
                <th>Precio</th>
                                <?php 
        foreach ($carro as $producto) {
            if ($producto['disponible'] == 0) {
                $carrito->remove_producto($producto['unique_id']);
            }
            if ($producto['cantidad'] == 0) {
                $carrito->remove_producto($producto['unique_id']);
            }
            ?>
<tr>
                        <td hidden="hide"><?php 
            echo $producto["unique_id"];
            ?>
</td>

                        <td><img style="max-width: 100px;max-height: 100px;" src="../css/imagenes/<?php 
            echo $producto["imagen"];
            ?>
"/></td>
<?php

require 'vendor/autoload.php';
$carro = new Carrito();
$carro->remove_producto($_GET['id']);
header('Location:verCarro.php');
<?php

//verific la instancia de
if (!class_exists('Carrito')) {
    include 'Carrito.php';
}
$vlcCodProduct = $_POST['id'];
if ($vlcCodProduct != "") {
    $vloCarrito = new Carrito();
    $vlbRes = $vloCarrito->remove_producto($vlcCodProduct);
    if ($vlbRes) {
        $vlntotalReg = $vloCarrito->articulos_total();
        $vloDetCarrito = (include 'MostrarCarrito.php');
        echo $vloDetCarrito . "|" . $vlntotalReg;
    }
}
Beispiel #4
0
 case 'add':
     $platoBLL = new PlatoBLL();
     $id = $_GET['id'];
     $vPlato = $platoBLL->ConsultarRegistro($id);
     $idProducto = $vPlato[0][0];
     $nombre = $vPlato[0][1];
     $precio = $vPlato[0][2];
     $foto = $vPlato[0][3];
     $cantidad = $_GET['cantidad'];
     $productoAlCarro = array("id" => $idProducto, "nombre" => $nombre, "precio" => $precio, "foto" => $foto, "cantidad" => $cantidad);
     $carrito->add($productoAlCarro);
     //header ( 'Location: pedido.php' );
     break;
 case 'delete':
     $unique_id = $_GET['id'];
     $carrito->remove_producto($unique_id);
     // header ( 'Location: pedido.php' );
     break;
 case 'update':
     $unique_id = $_GET['id'];
     $cantidad = $_GET['cantidad'];
     if ($cantidad === 0 || empty($cantidad) || $cantidad === null) {
         $carrito->remove_producto($unique_id);
     } else {
         $carrito->update_cantidad($unique_id, $cantidad);
     }
     // header ( 'Location: pedido.php' );
     break;
 case 'ordenar':
     $id_plato = $_GET['id'];
     $unique_id = $_GET['unique_id'];