| Server IP : 74.208.250.37 / Your IP : 216.73.216.114 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ubuntu 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : miferval ( 1000) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/araltecservicios/public/pages/ |
Upload File : |
<?php /** * cart.php */ $total = 0; $qty = 0; $shipping = 0; $discount = 0; ?> <?php include 'template/header.php'; ?> <div id="main"> <div class="container py-5"> <div class="h3 mb-5 border-bottom"> Carrito de Compras </div> <div id="cart" class="pt-2"> <div id="cartItems"> <?php if (isset($_SESSION['cart']) && count($_SESSION['cart']) >= 1) : ?> <div class="row bg-blue text-white text-center py-2 h6"> <div class="col-md-6"> Producto </div> <div class="col-md-2"> Precio </div> <div class="col-md-1"> Cantidad </div> <div class="col-md-2"> SubTotal </div> </div> <div class="bg-light text-center"> <?php foreach ($_SESSION['cart'] as $item) : ?> <?php if ( isset($item['qty']) && isset($item['sku']) && isset($item['price'])) : ?> <?php $subtotal = $item['qty'] * $item['price']; $total = $total + $subtotal; $qty = $qty + $item['qty']; ?> <?php else : ?> <?php unset($_SESSION['cart']); ?> <script type="text/javascript">location.reload();</script> <?php endif; ?> <div id="row_cart-<?= $item['sku'] ?>" class="row py-1 lh-lg"> <div class="d-none d-md-inline-block col-md-1"> <a href="/producto/<?= $item['sku'] ?>"> <img src="/images/products/<?= $item['image'] ?>" height="100" /> </a> </div> <div class="col-2 col-md-2"> <?= $item['sku'] ?> </div> <div class="d-none d-md-inline-block col-md-3"> <?= $item['name'] ?> </div> <div class="col-2 col-md-2"> $<?= number_format($item['price'], 2); ?> </div> <div class="col-2 col-md-1"> <input type="number" step="1" min="0" max="" value="<?= $item['qty'] ?>" class="form-control text-center update-item px-0 px-sm-2" id="qty_<?= $item['sku'] ?>" data-sku="<?= $item['sku'] ?>" data-page="cart" /> </div> <div class="col-2 col-md-2"> $<?= number_format($subtotal , 2) ?> </div> <div class="col-md-1"> <div class="delete-item btn btn-light d-block d-sm-inline-block rounded-circle" title="remove" data-id="cart-<?= $item['sku'] ?>" data-sku="<?= $item['sku'] ?>" data-page="cart" > <i class="fas fa-close"></i> </div> </div> </div> <?php endforeach; ?> </div> <?php $_SESSION['publicCart']['qty'] = $qty; ?> <div class="row pt-3 m-md-0"> <div class="col-md-4 offset-md-8"> <div class="h3">Total</div> <div class="h6 border border-secondary rounded"> <div class="row p-2"> <div class="fw-bold col-6">SubTotal:</div> <div class="col-6">$<?= number_format($total , 2) ?></div> </div> <div class="row p-2"> <div class="fw-bold col-6">Envio:</div> <div class="col-6">$<?= number_format($shipping , 2) ?></div> </div> <?php $grandTotal = $total - $discount + $shipping; ?> <div class="row m-0 bg-blue text-white p-2"> <div class="fw-bold col-6">Total:</div> <div class="col-6">$<?= number_format($grandTotal , 2) ?></div> </div> </div> <div class="row py-2"> <div class="col-12"> <a href="/checkout" class="btn btn-blue form-control py-2"> Continuar con la compra </a> </div> </div> </div> </div> <?php else : ?> <?php include 'store/empty-cart.php'; ?> <?php endif; ?> </div> </div> </div> </div> <?php include 'template/footer.php'; ?>