-
-
Save parzibyte/1dfb5acfe9e99f0f31c4fc99eafa71c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php include_once "encabezado.php" ?> | |
<?php | |
include_once "funciones.php"; | |
$productos = obtenerProductosEnCarrito(); | |
if (count($productos) <= 0) { | |
?> | |
<section class="hero is-info"> | |
<div class="hero-body"> | |
<div class="container"> | |
<h1 class="title"> | |
Todavía no hay productos | |
</h1> | |
<h2 class="subtitle"> | |
Visita la tienda para agregar productos a tu carrito | |
</h2> | |
<a href="tienda.php" class="button is-warning">Ver tienda</a> | |
</div> | |
</div> | |
</section> | |
<?php } else { ?> | |
<div class="columns"> | |
<div class="column"> | |
<h2 class="is-size-2">Mi carrito de compras</h2> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Nombre</th> | |
<th>Descripción</th> | |
<th>Precio</th> | |
<th>Quitar</th> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
$total = 0; | |
foreach ($productos as $producto) { | |
$total += $producto->precio; | |
?> | |
<tr> | |
<td><?php echo $producto->nombre ?></td> | |
<td><?php echo $producto->descripcion ?></td> | |
<td>$<?php echo number_format($producto->precio, 2) ?></td> | |
<td> | |
<form action="eliminar_del_carrito.php" method="post"> | |
<input type="hidden" name="id_producto" value="<?php echo $producto->id ?>"> | |
<input type="hidden" name="redireccionar_carrito"> | |
<button class="button is-danger"> | |
<i class="fa fa-trash-o"></i> | |
</button> | |
</form> | |
</td> | |
<?php } ?> | |
</tr> | |
</tbody> | |
<tfoot> | |
<tr> | |
<td colspan="2" class="is-size-4 has-text-right"><strong>Total</strong></td> | |
<td colspan="2" class="is-size-4"> | |
$<?php echo number_format($total, 2) ?> | |
</td> | |
</tr> | |
</tfoot> | |
</table> | |
<a href="terminar_compra.php" class="button is-success is-large"><i class="fa fa-check"></i> Terminar compra</a> | |
</div> | |
</div> | |
<?php } ?> | |
<?php include_once "pie.php" ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment