<?php if (!isset($_SESSION['valid_user'])) { include '_nav.php'; } else { include '_navLogin.php'; } ?> </nav> <div id="wrapper"> <section> <div class="producto"> <div class="container"> <div class="row"> <?php $carrito = new carrito(); $productos = $carrito->get_content(); if (isset($_GET['error'])) { echo '<p>' . $_GET['error'] . '</p>'; } else { if ($carrito) { foreach ($productos as $producto) { echo "<p>Nombre:" . $producto["nombre"] . "</p>"; echo "<br />"; echo "<p>Referencia: " . $producto["id"] . "</p>"; echo "<br />"; echo "<p>Precio: " . $producto["precio"] * $producto['cantidad'] . "</p>"; echo "<br />"; echo "<p>cantidad:" . $producto['cantidad'] . "</p>"; echo "--------------------------"; } echo "<p>Precio: " . $carrito->precio_total() . "</p>";
$carrito->remove_producto($_POST['id']); } else { if (isset($_POST['Modificar'])) { $carrito->modificar_cantidad($_POST['id'], $_POST['cantidad']); } } header('Location: cesta.php'); } else { if (isset($_GET['accion']) and strcmp($_GET['accion'], "confirmar") == 0) { header('Location: checkout.php'); } else { if (isset($_GET['accion']) and strcmp($_GET['accion'], "checkout") == 0) { $carrito = new carrito(); if (isset($_POST['direccion']) && trim($_POST['direccion']) != "") { try { $Beans->realizarPedido($carrito->get_content(), $_POST['direccion']); header('Location: index.php'); } catch (Exception $e) { header("Location: checkout.php?error=" . $e->getMessage()); } } else { header("Location: checkout.php?error=La direccion no puede estar vacia"); } } else { if (isset($_GET['accion']) and strcmp($_GET['accion'], "listarCarrito") == 0) { header('Location: cesta.php'); } else { if (isset($_GET['accion']) and strcmp($_GET['accion'], "buscar") == 0) { if (isset($_POST['textBuscar']) && trim($_POST['textBuscar']) != "") { header('Location: resultado.php?q=' . $_POST['textBuscar']); } else {