File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/yogi/ClientSide/cart.php
Back
<?php include("header.php"); ?> <?php require_once("connection.php"); if(!empty($_GET["action"])) { switch($_GET["action"]) { //code for adding product in cart case "add": if(!empty($_GET["qty"])) { $p_id=$_GET["p_id"]; $result=mysqli_query($con,"SELECT * FROM product WHERE p_id='$p_id'"); while($productByCode=mysqli_fetch_array($result)){ $itemArray = array($productByCode["p_id"]=>array('p_type'=>$productByCode["p_type"], 'p_capacity'=>$productByCode["p_capacity"],'m_unit_id'=>$productByCode["m_unit_id"], 'price'=>$productByCode["price"], 'image'=>$productByCode["image"])); if(!empty($_SESSION["cart_item"])) { if(in_array($productByCode["p_id"],array_keys($_SESSION["cart_item"]))) { foreach($_SESSION["cart_item"] as $k => $v) { if($productByCode["p_id"] == $k) { if(empty($_SESSION["cart_item"][$k]["qty"])) { $_SESSION["cart_item"][$k]["qty"] = 0; } $_SESSION["cart_item"][$k]["qty"] += $_GET["qty"]; } } } else { $_SESSION["cart_item"] = array_merge($_SESSION["cart_item"],$itemArray); } } else { $_SESSION["cart_item"] = $itemArray; } } } break; // code for removing product from cart case "remove": if(!empty($_SESSION["cart_item"])) { foreach($_SESSION["cart_item"] as $k => $v) { if($_GET["p_id"] == $k) unset($_SESSION["cart_item"][$k]); if(empty($_SESSION["cart_item"])) unset($_SESSION["cart_item"]); } } break; // code for if cart is empty case "empty": unset($_SESSION["cart_item"]); break; } } ?> <body> <!--====== HEADER PART START ======--> <header id="header-part"> <!--===== HEADER TOP START =====--> <div class="header-top pt-15 pb-15 d-none d-lg-block"> <div class="container"> <div class="row"> <div class="col-lg-3 col-xl-3"> <div class="phone text-center text-lg-left"> <p>Phone : (+91 - 9898808200 )</p> </div> </div> <div class="col-lg-5 col-xl-6"> </div> <div class="col-lg-4 col-xl-3"> <div class="address text-center text-lg-right"> <p><i class="fa fa-map-marker"></i>31,sarjan industrial park,vatva</p> </div> </div> </div> <!-- row --> </div> <!-- container --> </div> <!--===== HEADER TOP ENDS =====--> <!--===== NAVBAR START =====--> <?php include("NavBar.php"); ?> <!--===== NAVBAR ENDS =====--> </header> <!--====== HEADER PART ENDS ======--> <!--====== PAGE BANNER PART START ======--> <section id="page-banner" class="pt-200 pb-15"> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="page-banner-content"> <h3>Cart page</h3> </div> </div> </div> </div> </section> <!--====== PAGE BANNER PART ENDS ======--> <!--====== CART PART START ======--> <section id="cart-part" class="pt-75"> <div class="container"> <div class="row"> <div class="col-lg-12"> <div class="cart-table table-responsive"> <table class="table table-bordered"> <thead> <tr> <th class="product">Product</th> <th class="description">Description</th> <th class="edit">Edit</th> <th class="quantite">Quantite</th> <th class="price">Unit Price</th> <th class="total">Total</th> </tr> </thead> <tbody> <?php require_once("connection.php"); if(isset($_SESSION['cart'])) foreach($_SESSION['cart'] as $item=>$cnt) { $sql = "SELECT `product`.`p_id` AS 'ID',`product`.`p_type` AS 'TYPE',`product`.`image` AS 'IMG',`product`.`p_capacity` AS 'CAPI',`product`.`price` AS 'PRICE',`m_unit_master`.`m_unit` AS 'M_UNIT' FROM `product`,`m_unit_master`WHERE `m_unit_master`.`m_unit_id` = `product`.`m_unit_id` AND `product`.`p_id` = $item"; $rows = $con->query($sql); $row = $rows->fetch_assoc(); ?> <tr> <td> <div class=""> <img src="<?php echo $row['IMG']; ?>" alt="" width="70px"> </div> </td> <td><div class="product-description"> <h6><?php echo $row['TYPE']; ?></h6> <p>Capacity: <?php echo $row['CAPI']." ".$row['M_UNIT']; ?></p> </div></td> <td><div class="product-edit"> <ul> <li><a href="#"><i class="fa fa-trash-o"></i></a></li> </ul> </div></td> <td><div class="product-quantite"> <div> <p><?php echo $cnt; ?></p> </div> </div></td> <td><div class="product-price"> <p>Rs. <span id="p<?php echo $item; ?>"><?php echo $row['PRICE']; ?></span></p> </div></td> <td><div class="product-total"> <p>Rs. <?php echo $row['PRICE']*$cnt; ?></span></p> </div></td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12" style="margin-bottom: 20px;"> <div class="cart-total text-right mt-50"> <p><span>Subtotal </span><span>$999.00 </span></p> <p><span>Grand Total </span><span>$999.00 </span></p> <a href="">PROCED TO CHECKOUT</a> </div> </div> </div> </div> </section> <!--====== CART PART ENDS ======--> <!--====== DELIVERY PART START ======--> <section id="delivery-part" class="bg_cover" data-overlay="8" style="background-image: url(images/bg-2.jpg)"> <div class="container"> <div class="row align-items-center"> <div class="col-lg-7 offset-xl-1"> <div class="delivery-text text-center pb-30"> <h2>Water Delivery 20 k.m. Free Service</h2> <p></p> </div> </div> </div> </div> <div class="delivery-image d-none d-lg-flex align-items-end"> <img src="images/delivery-van.png" alt="Iamge"> </div> </section> <!--====== DELIVERY PART ENDS ======--> <!--====== FOOTER PART START ======--> <?php include("footer.php"); ?> <!--====== FOOTER PART ENDS ======--> <!--====== BACK TO TOP PART START ======--> <a href="#" class="back-to-top"> <img src="images/back-to-top.png" alt="Icon"> </a> <!--====== BACK TO TOP PART ENDS ======--> <!--====== Add to cart ======--> <div class="product"> </div> <!--====== jquery js ======--> <script src="js/vendor/modernizr-3.6.0.min.js"></script> <script src="js/vendor/jquery-1.12.4.min.js"></script> <!--====== Bootstrap js ======--> <script src="js/popper.min.js"></script> <script src="js/bootstrap.min.js"></script> <!--====== Owl Carousel js ======--> <script src="js/owl.carousel.min.js"></script> <!--====== Magnific Popup js ======--> <script src="js/jquery.magnific-popup.min.js"></script> <!--====== Slick js ======--> <script src="js/slick.min.js"></script> <!--====== Nice Number js ======--> <script src="js/jquery.nice-number.min.js"></script> <!--====== Nice Select js ======--> <script src="js/jquery.nice-select.min.js"></script> <!--====== Validator js ======--> <script src="js/validator.min.js"></script> <!--====== Ajax Contact js ======--> <script src="js/ajax-contact.js"></script> <!--====== Main js ======--> <script src="js/main.js"></script> <!--====== Google Map js ======--> <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDC3Ip9iVC0nIxC6V14CKLQ1HZNF_65qEQ"></script> <script src="js/map-script.js"></script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.9 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings