GIF89a php
Current File : /home/hencockfreshchic/public_html/app_old/cart.php
<?php
ob_start();
ini_set('error_reporting', E_STRICT);
include("session.php");
include("connect.php");
include("libs.php");
mysqli_set_charset($conn,'utf8');
date_default_timezone_set('Asia/Kolkata');

$sqlC="SELECT * FROM `my_cart` WHERE `user_id`='".$_COOKIE["user_id"]."' ORDER BY `sr` DESC";
$rsC=mysqli_query($conn,$sqlC);
$chkC=mysqli_num_rows($rsC);
if($chkC==0)
{
  echo '<script>window.location.href="dashboard.php";</script>';
}
?>
<!DOCTYPE html>
<html>

<?php include'head.php'; ?>
<body>
<?php include'header.php'; ?>
<div onclick="closeNav()">
 
  <div class="container no-gutters">
    <div class="row row-spac no-gutters">
       <div class="col-md-5 no-gutters" style="margin: auto;padding: 0px;">
        <div class="container m-0 p-0">
          <div class="row my-3">
          <h5 class="my-2"><i class="bi bi-bag-check-fill text-dark fs-4"></i>My Cart</h5>
          <h6 class="mx-3">Delivery in 1-2 Days</h6>
          </div>
          <?php 
          $SR=0;           
            while($rowC=mysqli_fetch_array($rsC)){
              $SR=$SR+1;
              $sqlP="SELECT * FROM `products` WHERE `sr`='".$rowC['prod_id']."'";
              $rsP=mysqli_query($conn,$sqlP);
              $rowP=mysqli_fetch_assoc($rsP);
          ?>
          <div class="row my-3 bg-light rounded border">
            <div class="col-3 py-3">
              <figure class="figure my-3">
                 <img src="<?php echo "../admin.cpanel/".$rowP["image"]; ?>" class="figure-img img-fluid" style="width: 200px; height: 80px" onclick="pageRedirect('description.php?prod_id=<?php echo $rowP["sr"] ?>')">
               </figure>
            </div>
            <div class="col-4 py-3">
               <p class="latter-size fw-bold text-success m-0" onclick="pageRedirect('description.php?prod_id=<?php echo $rowP["sr"] ?>')"><?php echo ucfirst($rowP["p_name"]); ?></p>
               <?php if($rowP["p_color"]<>""){ ?>
               <span class="card-link text-dark">Color : <?php echo ucfirst($rowP["p_color"]); ?></span><br>
             <?php } ?>
             <?php if($rowP["p_size"]<>""){ ?>
               <span class="card-link text-dark">Weight : <?php echo ucfirst($rowP["p_size"]); ?></span><br>
               <?php } ?>
               <span class="card-link text-dark fw-bold">Price : <?php echo totalPrice($rowC['prod_price'],$rowC['qty']); ?></span>
            </div>
            
            <div class="col-5 py-3 wrap text-center">
              <h6 class="text-end my-0"><a class="text-danger text-decoration-none" onclick="delCart('<?php echo $_COOKIE['user_id']; ?>','<?php echo $rowP["sr"]; ?>')">✖</a></h6>
              <label class="form-label d-block">QTY</label>
                 <button type="button" id="sub" class="sub btn btn-sm btn-success d-inline fw-bold" onclick="minus('cart<?php echo $SR; ?>','<?php echo $rowP["sr"]; ?>','<?php echo $rowP["sale_price"]; ?>')">-</button>

                  <input class="count form-control d-inline mx-0" type="text" id="cart<?php echo $SR; ?>" value="<?php echo $rowC['qty']; ?>" min="1" max="100" style="width:30%;">

                <button type="button" id="add" class="add btn btn-sm btn-success d-inline mx-0" onclick="plus('cart<?php echo $SR; ?>','<?php echo $rowP["sr"]; ?>','<?php echo $rowP["sale_price"]; ?>')">+</button>
            </div>
          </div>
        <?php } ?>
          <?php
              $sqlPV="SELECT * FROM `prod_view` ORDER BY `total_view` DESC LIMIT 2";
                $rsPV=mysqli_query($conn,$sqlPV);
                $chkPV=mysqli_num_rows($rsPV);
                if($chkPV>0){
          ?>
          <div class="row my-3">
            <h5 class="my-3">Before You Checkout</h5>
            <?php
                  while($rowPV=mysqli_fetch_array($rsPV)){

                  $sqlP2="SELECT * FROM `products` WHERE `sr`='".$rowPV['prod_id']."'";
                  $rsP2=mysqli_query($conn,$sqlP2);
                  $rowP2=mysqli_fetch_assoc($rsP2);
            ?>
            <div class="col-6">
              <div class="card py-2">
                <span><button type="button" class="btn btn-primary btn-sm py-0 px-1 mx-1 rounded-pill"><small><?php echo discountCal($rowP2["sale_price"],$rowP2["real_price"]); ?>% OFF</small></button></span>
                  <img src="<?php echo "../admin.cpanel/".$rowP2["image"]; ?>" class="figure-img img-fluid mx-auto d-flex w-90" style="height: 100px" onclick="pageRedirect('description.php?prod_id=<?php echo $rowP2["sr"] ?>')">
                <div class="card-body">
                  <p class="latter-size fw-bold text-success m-0" onclick="pageRedirect('description.php?prod_id=<?php echo $rowP2["sr"] ?>')"><?php echo ucfirst($rowP2["p_name"]); ?></p>
                  <span class="card-link text-dark">Weight : <?php echo ucfirst($rowP2["p_size"]); ?></span><br>
                  <span class="card-link text-dark fw-bold">Price : <?php echo $rowP2["sale_price"]; ?></span>
                  <span class="card-link"><button type="button" class="btn btn-outline-success btn-sm" onclick="addCart('<?php echo $rowP2["sr"]; ?>','<?php echo $_COOKIE["user_id"]; ?>','<?php echo $rowP2["sale_price"]; ?>','1')">ADD</button></span>
                </div>
              </div>
            </div>
            <?php } ?>
          </div>
          <?php } ?>



          <div class="row bg-light my-2">
            <div class="col-12 rounded">
                 <ul class="list-group list-group-flush mx-2" >
                <li class="list-group-item px-0 bg-light fw-light">
                <div class="float-start text-muted">
                  <h5 class="my-2 text-dark"><i class="bi bi-bag-dash-fill text-dark fs-4"></i> Use Coupons</h5>
                </div>
                <div class="form-group my-1">
                      <input type="text" class="form-control " name="coupon" id="coupon" placeholder="Enter Coupon Code Here...">
                      <button type="button" class="btn btn-sm btn-success fw-light float-end my-2" onclick="applyCouponCode()"><small>APPLY</small></button>
                    </div>
                </li>
              </ul>
            </div>
          </div>
         <div id="grandTotal"></div>
          <div class="row bg-light my-2">
            <div class="col-12 p-4">
              <h5 class="my-2 text-dark">Cancellation Policy</h5>
              <p class="text-muted">
                Dear customer, If you cancel the order after receiving or want to make a return order then 15% cancellation amount will be charged.
              </p>
            </div>
          </div>
          <div class="row">
            <div class="col-12 py-1">
             <div><button class="btn btn-sm btn-outline-success mt-1 mb-5 fs-6 float-end" type="button" onclick="pageRedirect('shipingDetails.php')">Proceed to Checkout <i class="bi bi-arrow-right-circle-fill text-info fs-5"></i></button></div>
            </div>
          </div>
        </div>
       </div>
     </div>
   </div> 
  <div class="container no-gutters mb-5">
      <div class="row row-spac no-gutters">
       <div class="col-md-5 no-gutters" style="margin: auto;padding: 0px;">
         <!-- <img src="assest/images/banner/img-12.png" class="img-fluid mx-auto d-flex" style="height: auto; max-width: 90%;"> --> 
       </div>
     </div>
   </div>

</div>
<?php include 'footer.php';?>
<script>
function myFunction() {
  var dots = document.getElementById("dots");
  var moreText = document.getElementById("more");
  var btnText = document.getElementById("myBtn");

  if (dots.style.display === "none") {
    dots.style.display = "inline";
    btnText.innerHTML = "Read more"; 
    moreText.style.display = "none";
  } else {
    dots.style.display = "none";
    btnText.innerHTML = "Read less"; 
    moreText.style.display = "inline";
  }
}
</script>
  <script>
function openNav() {
  document.getElementById("mySidebar").style.width = "250px";
  document.getElementById("main").style.marginLeft = "250px";
}

function closeNav() {
  document.getElementById("mySidebar").style.width = "0";
  document.getElementById("main").style.marginLeft= "0";
}
</script>
<!-- <script>
  $('.add').click(function () {   
  var th = $(this).closest('.wrap').find('.count');     
  th.val(+th.val() + 1);
});
$('.sub').click(function () {
  var th = $(this).closest('.wrap').find('.count');     
      if (th.val() > 1) th.val(+th.val() - 1);
});
</script> -->
<script type="text/javascript">
  $(document).ready(function(){  
   loadGrandTotal(); 
});  
</script>
</body>
</html>


<div id="snackbar"><span id="snack_msgg" style="color: white"></span></div>