ok
Direktori : /proc/self/root/home2/selectio/www/ramali.in/ |
Current File : //proc/self/root/home2/selectio/www/ramali.in/card-details1.php |
<?php include "header1.php"; if(!isset($_SESSION['ramali_textiles'])){ echo ("<script LANGUAGE='JavaScript'> window.alert('Please Login...'); window.location.href='index.php'; </script>"); } ?> <!-- Start of Main --> <main class="main cart"> <!-- Start of Breadcrumb --> <nav class="breadcrumb-nav"> <div class="container"> <ul class="breadcrumb shop-breadcrumb bb-no"> <li class="active" style="font-size: 35px;margin-bottom: -2%;"> Cart Details </li> </ul> </div> </nav> <!-- End of Breadcrumb --> <!-- Start of PageContent --> <div class="page-content"> <div class="container"> <form id="" action="checkout.php" method="POST"> <div class="row gutter-lg mb-10"> <div class="col-lg-8 pr-lg-4 mb-6"> <div id="add_to_cart_div"> <table class="shop-table cart-table"> <thead> <tr> <th class="product-name"><span>Product</span></th> <th></th> <th class="product-price"><span>Price</span></th> <th class="product-quantity"><span>Quantity</span></th> <th class="product-subtotal"><span>Subtotal</span></th> </tr> </thead> <tbody> <?php $statement = $pdo->prepare("SELECT cart.*,products.image,products.name,product_variant.price FROM `cart` LEFT JOIN products ON products.id=cart.product_id LEFT JOIN product_variant ON product_variant.id=cart.product_variant_id WHERE user_id=".$_SESSION['ramali_textiles']['id']); $statement->execute(); $cart = $statement->fetchAll(PDO::FETCH_ASSOC); foreach ($cart as $rowcart) { ?> <tr class="row_cart" data-rowid="<?=$rowcart['id'];?>"> <td class="product-thumbnail"> <div class="p-relative"> <figure> <img src="dashboard/<?=$rowcart['image'] ?>" alt="product" width="300" height="338"> </figure> <span class="btn btn-close cart_remove" id="<?=$rowcart['id']; ?>" > <i class="fas fa-times"></i> </span> </div> </td> <td class="product-name"> <?=$rowcart['name'] ?> </td> <td class="product-price"> <span class="amount "><i class="bi bi-currency-rupee"></i> <span class="product_price"><?=number_format($rowcart['price'],2) ?></span></span> </td> <td class="product-quantity"> <div class="input-group"> <input value="<?=$rowcart['price']?>" id="total_price" name="price[]" type="hidden"> <input class="quantity form-control pro_quantity" id="pro_quantity" type="number" min="1" max="100000"> <button class="quantity-plus w-icon-plus plus"></button> <button class="quantity-minus w-icon-minus plus"></button> <!--<input type="number" value="" id="pro_quantity" onkeyup="myFunction('<?=$rowcart['id']; ?>','total_quantity')" class="quantity form-control pro_quantity" style="max-width: 50%;">--> </div> </td> <td class="product-subtotal"> <span class="amount"> <i class="bi bi-currency-rupee"></i> <span class="product_total"><?=number_format($rowcart['price'],2)?></span> </span> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="cart-action mb-6"> <a href="index.php" class="btn btn-dark btn-rounded btn-icon-left btn-shopping mr-auto"><i class="w-icon-long-arrow-left"></i>Continue Shopping</a> </div> </div> <div class="col-lg-4 sticky-sidebar-wrapper"> <div class="sticky-sidebar"> <div class="cart-summary mb-4"> <h3 class="cart-title text-uppercase">Cart Totals</h3> <div class="cart-subtotal d-flex align-items-center justify-content-between"> <label class="ls-25">Subtotal</label> <span><i class="bi bi-currency-rupee"></i><span class="grand_total" id="product_grand_total">0.00</span></span> </div> <hr class="divider"> <hr class="divider mb-6"> <div class="order-total d-flex justify-content-between align-items-center"> <label>Total</label> <span class="ls-50"> <i class="bi bi-currency-rupee"></i><span class="grand_total" id="all_product_grand_total">0.00</span> </span> </div> <button type="submit" class="btn btn-dark btn-block btn-rounded"> Proceed to Checkout </button> </div> </div> </div> </div> </form> </div> </div> <!-- End of PageContent --> </main> <!-- End of Main --> <?php include "footer1.php"?> <script> $(document).on('click', '.cart_remove', function(){ var cart_items_id = $(this).attr('id'); var element = $('[data-rowid="'+cart_items_id+'"]'); $.ajax({ url: 'ui-api/api-cart.php', type: 'post', data :{pro_id:cart_items_id,type:'remove'}, success: function (response) { console.log(response); element.remove(); grand_total(); cart_count(); } }); }); function myFunction(pro_id,total_quantity){ var quantity = $("#pro_quantity").val(); console.log(quantity); $.ajax({ url: 'ui-api/api-cart.php', type: 'post', data :{quantity:quantity,type:'total_quantity',pro_id:pro_id}, success: function (response) { console.log(response); $('#add_to_cart_div').append(response); //total_quantity(); } }); } $(document).ready(function(){ grand_total(); $("body").on("click",".plus",function(){ console.log("clicked"); var qty=Number($(this).closest("tr").find(".pro_quantity").val()); var price=Number($(this).closest("tr").find(".product_price").text()); console.log(qty); console.log(price); $(this).closest("tr").find(".product_total").text(price*qty); grand_total(); }); $("body").on("keyup",".pro_quantity",function(){ var qty=Number($(this).closest("tr").find(".pro_quantity").val()); var price=Number($(this).closest("tr").find(".product_price").text()); $(this).closest("tr").find(".product_total").text(price*qty); grand_total(); }); }); function grand_total(){ var tot=0; $(".product_total").each(function(){ tot+=Number($(this).text()); }); $("#product_grand_total").text(tot); $("#all_product_grand_total").text(tot); } </script>