Server IP : 103.53.40.154 / Your IP : 3.139.72.152 Web Server : Apache System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : ppcad7no ( 715) PHP Version : 8.2.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home2/ppcad7no/activesports.co.in/../comfortaircon.co/../rajwadahouse.com/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<?php session_start(); ?> <!doctype html> <html class="no-js" lang="zxx"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <?php include "top-links.php";?> <title>Cart</title> <style> .order{ background-color: #f5f5f5; padding:15px; margin:auto; width: 100%; } .order span{ color:#0e0e0e; font-size:16px; line-height:33px; } </style> </head> <body> <div id="main-wrapper"> <?php include "header.php";?> <!-- Page Banner Section Start --> <div class="page-banner-section section bg-image" data-bg="assets/images/bg/breadcrumb.jpg"> <div class="container"> <div class="row"> <div class="col"> <div class="page-banner text-center"> <h1>Cart</h1> <ul class="page-breadcrumb"> <li><a href="<?php echo $wspath; ?>">Home</a></li> <li>Cart</li> </ul> </div> </div> </div> </div> </div> <div class="cart-section section pt-100 pt-lg-80 pt-md-70 pt-sm-60 pt-xs-50"> <div class="container sb-border pb-70 pb-lg-50 pb-md-40 pb-sm-30 pb-xs-20"> <div class="row"> <div class="col-12"> <!-- Cart Table --> <div class="cart-table table-responsive mb-30"> <table class="table"> <thead> <tr> <th class="pro-thumbnail">Image</th> <th class="pro-title">Product</th> <th class="pro-price">Price</th> <th class="pro-quantity">Quantity</th> <th class="pro-subtotal">Total</th> <th class="pro-remove">Remove</th> </tr> </thead> <tbody> <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) : ?> <?php $total = 0; $totalQuantity = 0; $productNames = []; $productQuantities = []; foreach ($_SESSION['cart'] as $key => $value) : $itemName = htmlspecialchars($value['name'], ENT_QUOTES, 'UTF-8'); $itemQuantity = (int) htmlspecialchars($value['quantity'], ENT_QUOTES, 'UTF-8'); $itemPrice = (float) htmlspecialchars($value['price'], ENT_QUOTES, 'UTF-8'); $itemImage = htmlspecialchars($value['image'], ENT_QUOTES, 'UTF-8'); $itemSubtotal = $itemPrice * $itemQuantity; $total += $itemSubtotal; $totalQuantity += $itemQuantity; $productNames[] = $itemName; $productQuantities[] = $itemQuantity; ?> <tr> <td class="pro-thumbnail"> <img src="<?php echo $itemImage; ?>" alt="Product"> </td> <td class="pro-title"> <a href="#"><?php echo $itemName; ?></a> </td> <td class="pro-price"> <span>₹<?php echo number_format($itemPrice, 2); ?></span> </td> <td class="pro-quantity"> <form action="add-cart.php" method="POST"> <div class="quantity"> <button type="button" class="qty-btn" data-action="decrease" onclick="updateQuantity(this, -1)">-</button> <input type="number" style="width: 50px;" name="mod_quantity" value="<?php echo $itemQuantity; ?>" min="1" onChange="this.form.submit();"> <button type="button" class="qty-btn" data-action="increase" onclick="updateQuantity(this, 1)">+</button> </div> <input type="hidden" name="name" value="<?php echo $itemName; ?>"> <input type="hidden" name="sr_no" value="<?php echo $value['id']; ?>"> </form> </td> <td class="pro-subtotal"> <span>₹<?php echo number_format($itemSubtotal, 2); ?></span> </td> <td class="pro-remove"> <form action="add-cart.php" method="POST"> <button name="remove_product" value="<?php echo $key; ?>" class="btn"> <i class="fa fa-trash-o"></i> </button> <input type="hidden" name="name" value="<?php echo $itemName; ?>"> </form> </td> </tr> <?php endforeach; ?> <?php endif; ?> </tbody> </table> </div> <div class="row"> <div class="col-lg-6 col-12 mb-5"> <h3><a href="<?php echo $wspath?>shop.html">Keep Shopping</a></h3> </div> <!-- Cart Summary --> <div class="col-lg-6 col-12 mb-30 d-flex"> <form action="checkout.html" method="POST" class="order"> <h3 class="cart_summary-header">Order Summary</h3> <div class="cart_summary-table"> <div class="cart_summary-table_row d-flex justify-content-between"> <span class="property">Shipping</span> <span class="value">Free</span> </div> <?php if (isset($_SESSION['cart']) && !empty($_SESSION['cart'])) : ?> <?php $total = 0; $totalQuantity = 0; $productNames = array(); $productQuantities = array(); foreach ($_SESSION['cart'] as $key => $value) { $subtotal = $value['price'] * $value['quantity']; $total += $subtotal; $totalQuantity += $value['quantity']; $productQuantities[] = $value['quantity']; $productNames[] = $value['name']; } ?> <input type="hidden" name="total_quantity" value="<?php echo $totalQuantity; ?>"> <input type="hidden" name="product_quantities" value="<?php echo implode(',', $productQuantities); ?>"> <input type="hidden" name="product_names" value="<?php echo implode(', ', $productNames); ?>"> <input type="hidden" name="total_price" value="<?php echo number_format($total, 2); ?>"> <?php endif; ?> <div class="cart_summary-table_row cart_summary-table_row--total d-flex justify-content-between"> <span class="property">Total Products</span> <span class="value"><?php echo $totalQuantity; ?></span> </div> <div class="cart_summary-table_row cart_summary-table_row--total d-flex justify-content-between"> <span class="property">Total</span> <span class="value" id="g2total">₹<?php echo number_format($total, 2); ?></span> </div> </div> <button class="cart_summary-btn btn" type="submit" name="check-btn">Checkout</button> </form> </div> </div> </div> </div> </div> </div> <script> // Function to handle quantity update buttons function updateQuantity(button, delta) { let input = button.parentNode.querySelector('input[name="mod_quantity"]'); let newValue = parseInt(input.value) + delta; if (newValue >= 1) { input.value = newValue; input.form.submit(); } } </script> <?php include "footer.php";?> </div> </body> </html>