File manager - Edit - /home/custbahd/public_html/webs/monitor/clients/marylhouse/index/cart.php
Back
<?php session_start(); require_once("db/dbcontroller.php"); $db_handle = new DBController(); if(!empty($_GET["action"])) { switch($_GET["action"]) { case "add": if(!empty($_POST["quantity"])) { $productByCode = $db_handle->runQuery("SELECT * FROM shop WHERE code='" . $_GET["code"] . "'"); $itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'type'=>$productByCode[0]["type"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"], 'image'=>$productByCode[0]["image"])); $productByCode = $db_handle->runQuery("SELECT * FROM shop WHERE code='" . $_GET["code"] . "'"); $itemArray = array($productByCode[0]["code"]=>array('name'=>$productByCode[0]["name"], 'code'=>$productByCode[0]["code"], 'type'=>$productByCode[0]["type"], 'quantity'=>$_POST["quantity"], 'price'=>$productByCode[0]["price"], 'image'=>$productByCode[0]["image"])); if(!empty($_SESSION["cart_item"])) { if(in_array($productByCode[0]["code"],array_keys($_SESSION["cart_item"]))) { foreach($_SESSION["cart_item"] as $k => $v) { if($productByCode[0]["code"] == $k) { if(empty($_SESSION["cart_item"][$k]["quantity"])) { $_SESSION["cart_item"][$k]["quantity"] = 0; } $_SESSION["cart_item"][$k]["quantity"] += $_POST["quantity"]; } } } else { $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"],$itemArray); } } else { $_SESSION["cart_item"] = $itemArray; } } break; case "remove": if(!empty($_SESSION["cart_item"])) { foreach($_SESSION["cart_item"] as $k => $v) { if($_GET["code"] == $k) unset($_SESSION["cart_item"][$k]); if(empty($_SESSION["cart_item"])) unset($_SESSION["cart_item"]); } } break; case "empty": unset($_SESSION["cart_item"]); break; } } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Maryl Cart</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <!-- Favicon --> <link rel="icon" href="logo/glass3.png"> <link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,700;0,800;1,200;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="css/animate.css"> <link rel="stylesheet" href="css/owl.carousel.min.css"> <link rel="stylesheet" href="css/owl.theme.default.min.css"> <link rel="stylesheet" href="css/magnific-popup.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/css/bootstrap-select.min.css"> <link rel="stylesheet" href="css/flaticon.css"> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="wrap"> <div class="container"> <div class="row"> <div class="col-md-6 d-flex justify-content-md-end"> <div class="social-media mr-4"> <p class="mb-0 d-flex"> <a href="#" class="d-flex align-items-center justify-content-center"><span class="fa fa-facebook"><i class="sr-only">Facebook</i></span></a> <a href="#" class="d-flex align-items-center justify-content-center"><span class="fa fa-twitter"><i class="sr-only">Twitter</i></span></a> <a href="#" class="d-flex align-items-center justify-content-center"><span class="fa fa-instagram"><i class="sr-only">Instagram</i></span></a> <a href="#" class="d-flex align-items-center justify-content-center"><span class="fa fa-whatsapp"><i class="sr-only">WhatsApp</i></span></a> </p> </div> <div class="reg"> <p class="mb-0"><a href="#" class="mr-2">Sign Up</a> <a href="#">Log In</a></p> </div> </div> </div> </div> </div> <nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark ftco-navbar-light" id="ftco-navbar"> <div class="container"> <a class="navbar-brand" href="index.php">Maryl <span>House</span> </a> <!--Shopping cart--> <!--Cart icon start--> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <!--Cart icon with quantity start--> <div class="order-lg-last btn-group"> <a href="#" class="btn-cart dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="flaticon-shopping-bag"></span> <div class="d-flex justify-content-center align-items-center"><small><?php echo $total_quantity; ?></small></div> </a> <div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-item"> <a href="cart.html">Proceed <span class="ion-ios-arrow-round-forward"></span></a> <a href="index.php?action=empty" style="float:right;color:#d00000">Empty Cart</a> </div> <div class="dropdown-item" href="#"> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <div style="margin-left:-20px"><?php echo "<img src='admin/shop/images/".$item['image']."' width='30%'>"; ?></div> <div class="" style="float: right;margin-top:-80px;"> <b text-align="center"><?php echo $item["name"]; ?></b> <p class="mb-0"><span class="quantity ml-3">Quantity: <?php echo $item["quantity"]; ?> <span style="color:#d00000">*</span> <?php echo "UGX ". number_format ($item["price"]); ?></span> <br> <a href="#" class="price"> <span style="color:#d00000">TOTAL:</span> <strong><?php echo "UGX ". number_format ($item_price); ?></strong></a> <a href="cart.php?action=remove&code=<?php echo $item["code"]; ?>" class="btnRemoveAction"><img src="icon-delete.png" alt="Remove Item" /></a></p> </div> <hr> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> </div> </div> <?php } else { ?> <div class="no-records">Your Cart is Empty</div> <?php } ?> </div> <!--Cart icon with quantity end--> <?php } else { ?> <!--Cart icon without quantity--> <div class="order-lg-last btn-group"> <a href="#" class="btn-cart dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <span class="flaticon-shopping-bag"></span> </a> <div class="dropdown-menu dropdown-menu-right"> <div class="dropdown-item d-flex align-items-start" href="#"> Your Cart is Empty </div> </div> </div> <!--Cart icon without quantity end--> <?php } ?> <!--Shopping Cart icon end--> <!--Responsive menu--> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-label="Toggle navigation"> <span class="oi oi-menu"></span> Menu </button> <div class="collapse navbar-collapse" id="ftco-nav"> <ul class="navbar-nav ml-auto"> <li class="nav-item active"><a href="index.php" class="nav-link">Home</a></li> <li class="nav-item"><a href="about.html" class="nav-link">About</a></li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="dropdown04" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Products</a> <div class="dropdown-menu" aria-labelledby="dropdown04"> <a class="dropdown-item" href="product.html">Products</a> <a class="dropdown-item" href="product-single.html">Single Product</a> <a class="dropdown-item" href="cart.html">Cart</a> <a class="dropdown-item" href="checkout.html">Checkout</a> </div> </li> <li class="nav-item"><a href="blog.html" class="nav-link">Blog</a></li> <li class="nav-item"><a href="contact.html" class="nav-link">Contact</a></li> </ul> </div> </div> </nav> <!-- END nav --> <section class="hero-wrap hero-wrap-2" style="background-image: url('images/bg_2.jpg');" data-stellar-background-ratio="0.5"> <div class="overlay"></div> <div class="container"> <div class="row no-gutters slider-text align-items-end justify-content-center"> <div class="col-md-9 ftco-animate mb-5 text-center"> <p class="breadcrumbs mb-0"><span class="mr-2"><a href="index.php">Home <i class="fa fa-chevron-right"></i></a></span> <span>Cart <i class="fa fa-chevron-right"></i></span></p> <!--My Cart start--> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <!--My Cart with quantity start--> <h2 class="mb-0 bread">My Cart</h2> <b style="color: dodgerblue">(<?php echo $total_quantity; ?> Items)</b> </div> </div> </div> <!-- My Cart with quantity end--> <?php } else { ?> <!-- My Cart without quantity--> <h2 class="mb-0 bread">My Cart</h2> <!--My Cart without quantity end--> <?php } ?> </section> <!--My Cart end--> <section class="ftco-section"> <div class="container"> <div class="row"> <div class="table-wrap"> <table class="table"> <thead class="thead-primary"> <tr> <th> </th> <th> </th> <th>Product</th> <th>Price</th> <th>Quantity</th> <th>total</th> <th>Delete</th> </tr> </thead> <tbody> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <tr class="alert" role="alert"> <td> <label class="checkbox-wrap checkbox-primary"> <input type="checkbox" checked> <span class="checkmark"></span> </label> </td> <td> <div class="img"> <?php echo "<img src='admin/shop/images/".$item['image']."' width='100%'>"; ?></div> </td> <td> <div class="email"> <span><?php echo $item["name"]; ?></span> <span><?php echo $item["type"]; ?></span> </div> </td> <td><?php echo "UGX ". number_format ($item["price"]); ?></td> <td class="quantity"> <div class="input-group"> <input type="text" name="quantity" class="quantity form-control input-number" value="<?php echo $item["quantity"]; ?>" min="1" max="100"> </div> </td> <td> <?php echo "UGX ". number_format ($item_price); ?></strong> </td> <td> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true"><i class="fa fa-close"></i></span> </button> </td> <td><a href="cart.php?action=remove&code=<?php echo $item["code"]; ?>" class="btnRemoveAction"><img src="icon-delete.png" alt="Remove Item" /></a></td> </tr> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); } ?> <?php } else { ?> <!--Cart when empty--> <td> Your Cart is Empty </td> <td><a href="shop">Go Shopping</a></td> </div> <!--Cart when empty end--> <?php } ?> </tbody> </table> </div> </div> <div class="row justify-content-end"> <div class="col col-lg-5 col-md-6 mt-5 cart-wrap ftco-animate"> <div class="cart-total mb-3"> <h3>Cart Totals</h3> <!--Cart totals--> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; $total_amount = 0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <?php $total_quantity += $item["quantity"]; $total_price += ($item["price"]*$item["quantity"]); $total_amount = ($total_price+5000); } ?> <p class="d-flex"> <span>Subtotal</span> <span><?php echo "UGX ". number_format ($total_price); ?></span> </p> <p class="d-flex"> <span>Delivery</span> <span>UGX 5,000</span> </p> <p class="d-flex"> <span>Discount</span> <span>UGX 0.00</span> </p> <hr> <p class="d-flex total-price"> <span>Total</span> <span><?php echo "UGX ". number_format ($total_amount); ?></span> </p> </div> <p class="text-center"><a href="checkout.php" class="btn btn-primary py-3 px-4">Proceed to Checkout</a></p> <?php } else { ?> <!-- Cart total without quantity--> <span>No Results</span> <a href="shop">Go Shopping</a> <!--Cart total quantity end--> <?php } ?> </div> </div> </div> </section> <footer class="ftco-footer"> <div class="container"> <div class="row mb-5"> <div class="col-sm-12 col-md"> <div class="ftco-footer-widget mb-4"> <h2 class="ftco-heading-2 logo"><a href="#">Maryl <span>Wine</span> & <span>Liqour</span> House</a></h2> <p>Far far away, behind the wide mountains, far from the countries.</p> <ul class="ftco-footer-social list-unstyled mt-2"> <p align="center">Follow Us</p> <li class="ftco-animate"><a href="#"><span class="fab fa-twitter"></span></a></li> <li class="ftco-animate"><a href="#"><span class="fab fa-facebook"></span></a></li> <li class="ftco-animate"><a href="#"><span class="fab fa-instagram"></span></a></li> </ul> </div> </div> <div class="col-sm-12 col-md"> <div class="ftco-footer-widget mb-4 ml-md-4"> <h2 class="ftco-heading-2">Information</h2> <ul class="list-unstyled"> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>About us</a></li> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Terms of use</a></li> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Privacy</a></li> </ul> </div> </div> <div class="col-sm-12 col-md"> <div class="ftco-footer-widget mb-4"> <h2 class="ftco-heading-2">Quick Link</h2> <ul class="list-unstyled"> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Liqors</a></li> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Wines</a></li> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Brands</a></li> <li><a href="#"><span class="fa fa-chevron-right mr-2"></span>Shop</a></li> </ul> </div> </div> <div class="col-sm-12 col-md"> <div class="ftco-footer-widget mb-4"> <h2 class="ftco-heading-2">Contact Information</h2> <div class="block-23 mb-3"> <ul> <li><span class="icon fa fa-map marker"></span><span class="text">Kampala, Uganda</span></li> <li><a href="#"><span class="icon fa fa-phone"></span><span class="text">+256 392 3929 210</span></a></li> <li><a href="#"><span class="icon fa fa-paper-plane pr-4"></span><span class="text">info@narylhouse.com</span></a></li> </ul> </div> </div> </div> </div> </div> <div class="container-fluid px-0 py-5 bg-black"> <div class="container"> <div class="row"> <div class="col-md-12"> <p class="mb-0" style="color: rgba(255,255,255,.5);"> Copyright ©<script>document.write(new Date().getFullYear());</script> All rights reserved | <a href="https://colorlib.com" target="_blank">Maryl Wine & Liqour House</a> </p> </div> </div> </div> </div> </footer> <!-- loader --> <div id="ftco-loader" class="show fullscreen"><svg class="circular" width="48px" height="48px"><circle class="path-bg" cx="24" cy="24" r="22" fill="none" stroke-width="4" stroke="#eeeeee"/><circle class="path" cx="24" cy="24" r="22" fill="none" stroke-width="4" stroke-miterlimit="10" stroke="#F96D00"/></svg></div> <script src="js/jquery.min.js"></script> <script src="js/jquery-migrate-3.0.1.min.js"></script> <script src="js/popper.min.js"></script> <script src="js/bootstrap.min.js"></script> <script src="js/jquery.easing.1.3.js"></script> <script src="js/jquery.waypoints.min.js"></script> <script src="js/jquery.stellar.min.js"></script> <script src="js/owl.carousel.min.js"></script> <script src="js/jquery.magnific-popup.min.js"></script> <script src="js/jquery.animateNumber.min.js"></script> <script src="js/scrollax.min.js"></script> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBVWaKrjvy3MaE7SQ74_uJiULgl1JY0H2s&sensor=false"></script> <script src="js/google-map.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.13.1/js/bootstrap-select.min.js"></script> <script src="js/main.js"></script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 1.51 |
proxy
|
phpinfo
|
Settings