File manager - Edit - /home/cipherteam/htdocs/cipherteam.in/yogi/ClientSide/product.php
Back
<?php include("header.php"); require_once("Connection.php"); if(!empty($_GET["action"])) { switch($_GET["action"]) { case "add": if(!empty($_POST["quantity"])) { $productByCode = mysqli_query($con,"SELECT * FROM `productview` WHERE `PID`='" . $_GET["code"] . "'"); $row = mysqli_fetch_assoc($productByCode); $itemArray = array("P".$row["PID"]=>array('name'=>$row["PNAME"],'code'=>$row["PID"],'capicity'=>$row["CAPI"]." ".$row["MUNIT"],'quantity'=>$_POST["quantity"], 'price'=>$row["PRICE"], 'image'=>$row["IMG"])); if(!empty($_SESSION["cart_item"])) { if(in_array("P".$row["PID"],array_keys($_SESSION["cart_item"]))) { foreach($_SESSION["cart_item"] as $k => $v) { if("P".$row["PID"] == $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; } } ?> <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> </br></br> <div id="shopping-cart"> <div class="txt-heading">Shopping Cart</div> <a id="btnEmpty" href="Product.php?action=empty">Empty Cart</a> <?php if(isset($_SESSION["cart_item"])){ $total_quantity = 0; $total_price = 0; ?> <table class="tbl-cart" cellpadding="10" cellspacing="1"> <tbody> <tr> <th style="text-align:left;">Name</th> <th style="text-align:left;">Capacity</th> <th style="text-align:right;" width="5%">Quantity</th> <th style="text-align:right;" width="10%">Unit Price</th> <th style="text-align:right;" width="10%">Price</th> <th style="text-align:center;" width="5%">Remove</th> </tr> <?php foreach ($_SESSION["cart_item"] as $item){ $item_price = $item["quantity"]*$item["price"]; ?> <tr> <td><img src="<?php echo $item["image"]; ?>" class="cart-item-image" /><?php echo $item["name"]; ?></td> <td><?php echo $item["capicity"]; ?></td> <td style="text-align:right;"><?php echo $item["quantity"]; ?></td> <td style="text-align:right;"><?php echo "₹ ".$item["price"]; ?></td> <td style="text-align:right;"><?php echo "₹ ". number_format($item_price,2); ?></td> <td style="text-align:center;"><a href="product.php?action=remove&code=<?php echo "P".$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"]); } ?> <tr> <td colspan="2" align="right">Total:</td> <td align="right"><?php echo $total_quantity; ?></td> <td align="right" colspan="2"><strong><?php echo "₹ ".number_format($total_price, 2); ?></strong></td> <td><a href="#">Checkout</a></td> </tr> </tbody> </table> <form action="Check.php" method="POST"> <input type="text" name="c_id" value="<?php echo $_SESSION['c_id']; ?>" hidden> <div class="row"> <div class="col-1">Select Type:</div> <div class="col-2"> <select name="Type"> <?php $query=mysqli_query($con, "select * from ord_typ_master"); while($row=mysqli_fetch_array($query)) { ?> <option value="<?php echo $row['ot_id']; ?>"><?php echo $row["o_type"]; ?></option> <?php } ?> </select> </div> <div class="col-3">Starting Date:<input type="date" name="s_date"> </div> <div class="col-3">Ending Date:<input type="date" name="e_date"></div> <div class="div-3"><input type="submit" class="btn btn-success" value="Order"></div> </div> </form> <?php } else { ?> <div class="no-records">Your Cart is Empty</div> <?php } ?> </div> <div id="product-grid"> <div class="txt-heading">Products</div> <?php $rows = mysqli_query($con,"SELECT * FROM `productview` ORDER BY `PID` ASC"); while($row = mysqli_fetch_assoc($rows)){ ?> <div class="product-item"> <form method="post" action="product.php?action=add&code=<?php echo $row["PID"]; ?>"> <div class="product-image"><img src="<?php echo $row["IMG"]; ?>" class="center-image" width="200px" alt="prod"></div></br></br> <div class="product-tile-footer"> <div class="product-title"><?php echo $row["PNAME"]." [".$row["CAPI"]." ".$row["MUNIT"]."]"; ?></div> <div class="product-price"><?php echo "₹".$row["PRICE"]; ?></div> <div class="cart-action"><input type="text" class="product-quantity" name="quantity" value="1" size="2" /><input type="submit" value="Add to Cart" class="btnAddAction" /></div> </div> </br> </form> </div> <?php } ?> </div> <!--====== DELIVERY PART START ======--> </br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br></br> <!--====== DELIVERY PART ENDS ======--> <!--====== FOOTER PART START ======--> <?php include("footer.php"); ?> <!--====== FOOTER PART ENDS ======--> <!--====== 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.24 |
proxy
|
phpinfo
|
Settings