ok

Mini Shell

Direktori : /home2/selectio/public_html/ramali.in/
Upload File :
Current File : /home2/selectio/public_html/ramali.in/copy1.php

<?php include "header1.php";


//$_SESSION['ramali_textiles']['id'];

$query = $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']);
$query->execute();
$cart = $query->fetchAll(PDO::FETCH_ASSOC);



?>

<main class="main checkout">
    <!-- 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%;">
                            Checkout
                        </li>
                    </ul>
                </div>
            </nav>
            <!-- End of Breadcrumb -->

            <!-- Start of PageContent -->
            <div class="page-content">
                <div class="container">
                    
                    <div class="coupon-content mb-4">
                        <p>If you have a coupon code, please apply it below.</p>
                        <div class="input-wrapper-inline">
                            <input type="text" name="coupon_code" class="form-control form-control-md mr-1 mb-2" placeholder="Coupon code" id="coupon_code">
                            <button type="submit" class="btn button btn-rounded btn-coupon mb-2" name="apply_coupon" value="Apply coupon">Apply Coupon</button>
                        </div>
                    </div>
                    <form class="form checkout-form" action="#" method="post" id="checkout">
                        <div class="row mb-9">
                            <div class="col-lg-7 pr-lg-4 mb-4">
                                <h3 class="title billing-title text-uppercase ls-10 pt-1 pb-3 mb-0">
                                    Billing Details
                                </h3>
                                <div class="row gutter-sm">
                                    <div class="col-xs-6">
                                        <div class="form-group">
                                            <label>Name *</label>
                                            <input type="text" class="form-control form-control-md" value="<?=$_SESSION['ramali_textiles']['name']?>" name="firstname" required="">
                                        </div>
                                    </div>
                                    <div class="col-xs-6">
                                        <div class="form-group">
                                            <label>Email *</label>
                                            <input type="text" class="form-control form-control-md" value="<?=$_SESSION['ramali_textiles']['email']?>" name="lastname" required="">
                                        </div>
                                    </div>
                                    <div class="col-xs-6">
                                        <div class="form-group">
                                            <label>Mobile Number</label>
                                            <input type="text" class="form-control form-control-md" value="<?=$_SESSION['ramali_textiles']['mobile']?>" name="mobile_no">
                                        </div>
                                    </div>
                                    <div class="col-xs-6">
                                        <div class="form-group">
                                            <label>Alternate Mobile Number *</label>
                                            <input type="text" placeholder="Alternate Number" value="" class="form-control form-control-md mb-2" name="alternate_mobile_no">
                                        </div>
                                    </div>
                                </div>
                                
                                <div class="form-group">
                                    <label>Address *</label>
                                    <input type="text" placeholder="House number and street name" value="<?=$_SESSION['ramali_textiles']['area']?>"  class="form-control form-control-md mb-2" name="address" required="">
                                </div>
                                <div class="row gutter-sm">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>City *</label>
                                            <input type="text" value="<?=$_SESSION['ramali_textiles']['city']?>" class="form-control form-control-md" name="town" required="">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>Pincode *</label>
                                            <input type="text" value="<?=$_SESSION['ramali_textiles']['pincode']?>" class="form-control form-control-md" name="zip" required="">
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Country *</label>
                                        <input type="text" class="form-control form-control-md" name="country" required="">
                                    </div>
                                </div>
                            </div>
                            
                            
                            <div class="col-lg-5 mb-4 sticky-sidebar-wrapper">
                                <div class="pin-wrapper" style="height: 898.969px;"><div class="order-summary-wrapper sticky-sidebar" style="border-bottom: 1px solid rgb(238, 238, 238); width: 505px;">
                                    <h3 class="title text-uppercase ls-10">Your Order</h3>
                                    <div class="order-summary">
                                        <table class="order-table">
                                            <thead>
                                                <tr>
                                                    <th colspan="2">
                                                        <b>Product</b>
                                                    </th>
                                                </tr>
                                            </thead>
                                            <?php
                                            
                                                foreach($cart as $cart_total){
                                                    
                                                    $total_amount = $cart_total['qty']*$cart_total['price'];
                                                    
                                                    
                                            ?>
                                            <input name="product_id[]" type="hidden" value="<?=$cart_total['product_id']?>">
                                            <input name="product_name[]" type="hidden" value="<?=$cart_total['name']?>">
                                            <input name="product_qty[]" type="hidden" value="<?=$cart_total['qty']?>">
                                            <input name="product_sub_total[]" type="hidden" value="<?=$total_amount?>">
                                            <input name="product_price[]" type="hidden" value="<?=$cart_total['price']?>">
                                            <tbody>
                                                <tr class="bb-no">
                                                    <td class="product-name">
                                                        <?=$cart_total['name']?>
                                                        <i class="fas fa-times"></i> 
                                                        <span class="product-quantity">
                                                            <?=$cart_total['qty']?></span>
                                                    </td>
                                                    <td class="product-total">
                                                        <span class="one_product_price">
                                                             <?=$total_amount?></td>
                                                        </span>
                                                   
                                                </tr>
                                            </tbody>
                                                <tfoot>
                                                <tr class="order-total">
                                                    <th>
                                                        <b>Total</b>
                                                    </th>
                                                    <td>
                                                        <span class="total_product_price">
                                                            <b><i class="bi bi-currency-rupee"></i> <?=$total_amount?></b>
                                                          
                                                        </span>
                                                    </td>
                                                </tr>
                                            </tfoot>
                                            
                                            <?php } ?>
                                              <input name="total_amount" type="hidden" value="<?=$total_amount?>">
                                        </table>

                                        <div class="payment-methods" id="payment_method">
                                            <h4 class="title font-weight-bold ls-25 pb-0 mb-1">Payment Methods</h4>
                                            <div class="accordion payment-accordion">
                                                <!--<div class="card">
                                                    <div class="card-header">
                                                        <a href="#cash-on-delivery" class="collapse">Direct Bank Transfor</a>
                                                    </div>
                                                    <div id="cash-on-delivery" class="card-body expanded">
                                                        <p class="mb-0">
                                                            Make your payment directly into our bank account. 
                                                            Please use your Order ID as the payment reference. 
                                                            Your order will not be shipped until the funds have cleared in our account.
                                                        </p>
                                                    </div>
                                                </div>-->
                                                <div class="card">
                                                    <div class="card-header">
                                                        <input type="radio" name="type_payment" value="online_paytment" required>
                                                        <label>Online Payment</label>
                                                    </div>
                                                </div>
                                                <div class="card">
                                                    <div class="card-header">
                                                        <input type="hidden" name="pending" value="Pending">
                                                       <input type="radio" name="type_payment" value="cod_paytment" required>
                                                       <label>Cash On Delivery</label>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="form-group place-order pt-6">
                                            <button type="submit" class="btn btn-dark btn-block btn-rounded">
                                                    Place Order
                                            </button>
                                        </div>
                                    </div>
                                </div></div>
                            </div>
                        </div>
                    </form>
                    
                    
                    
                    
                </div>
            </div>
            <!-- End of PageContent -->
        </main>

<?php include "footer1.php"?>


<script>
    $('#checkout').on('submit', function(e){
        console.log("Click And Form Working");
                e.preventDefault();
                $('#loading-div').show();
                $('#content-div').hide();
                var formData = new FormData(this);
                formData.append('type', 'checkout_order');
                                $.ajax({
                            url: 'api/checkout.php',
                            type: 'post',
                            dataType: 'json',
                            data: formData,
                            cache: false,
                            contentType: false,
                            processData: false,
                            enctype: 'multipart/form-data',
                            success: function (response) {
                                if(response['status']==200){
                                     alert(response['message']);
                                     window.location.href="order-complete.php?id="+response['order_id'];
                                      $("#checkout").trigger("reset");
                                     $('#loading-div').hide();
                                     $('#content-div').show();
                                     
                                }else{
                                    alert(response['message']);
                                    $('#loading-div').hide();
                                    $('#content-div').show();
                                }
                                
                               
                            }
                        });
                
    });
    
    $(document).ready(function(){
            $("body").on("click",".plus",function(){
            console.log("clicked");
            var qty=Number($(this).closest("tr").find(".total_product_price").val());
            var price=Number($(this).closest("tr").find(".one_product_price").text());
            console.log(qty);
            console.log(price);
            $(this).closest("tr").find(".product_total").text(price*qty);
            grand_total();
        });
    });
    
     
    
</script>

Zerion Mini Shell 1.0