/
home
/
u462926129
/
domains
/
mkoihomeocare.com
/
public_html
/
Upload File
HOME
<?php include'config.php'; if(!isset($_SESSION['rand'])){ header('Location: index.php'); } ?> <!DOCTYPE html> <html lang="en"> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <!-- /Added by HTTrack --> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Checkout</title> <meta name="title" content=""> <meta name="keywords" content=""> <meta name="description" content=""> <link rel="icon" href="images/favicon.png"> <!-- <link rel="stylesheet" href="fonts/flaticon/flaticon.css"> <link rel="stylesheet" href="fonts/icofont/icofont.min.css"> <link rel="stylesheet" href="fonts/fontawesome/fontawesome.min.css"> <link rel="stylesheet" href="vendor/venobox/venobox.min.css"> <link rel="stylesheet" href="vendor/slickslider/slick.min.css"> <link rel="stylesheet" href="vendor/niceselect/nice-select.min.css"> <link rel="stylesheet" href="vendor/bootstrap/bootstrap.min.css"> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/checkout.css"> --> <?php include'include/header-file.php'; ?> </head> <body> <div class="backdrop"></div> <a class="backtop fas fa-arrow-up" href="#"></a> <?php include'include/header.php';?> <section class="inner-section single-banner" style="background: url() no-repeat center;"> <div class="container"> <h2>checkout</h2> <ol class="breadcrumb"> <li class="breadcrumb-item"><a href="index.html">Home</a></li> <li class="breadcrumb-item active" aria-current="page">checkout</li> </ol> </div> </section> <section class="inner-section checkout-part"> <div class="container-fluid"> <div class="row"> <?php $orderKey = $_SESSION['rand']; /*$productID = $_GET['id']; $quantity = 1; if(isset($_GET['q'])){ $quantity = $_GET['q']; } $sqld = mysqli_query($conn,"select * from $tblProduct where id='$productID'")or die(mysqli_error($conn)); $rowd = mysqli_fetch_assoc($sqld); $product_price = $rowd['sale_price']; $totalAmount = $product_price*$quantity;*/ $orderID = $_SESSION['rand']; $discount_amount=0; $shippingAmount=0; $orderKey = $_SESSION['rand']; $sqlo=mysqli_query($conn,"select * from $tblOrder where order_id='$orderKey'") or die(mysqli_error($conn)); $rowo = mysqli_fetch_assoc($sqlo); $sql=mysqli_query($conn,"select sum(total) as total_amount from $tblOrderDetails o where order_id='$orderKey'") or die(mysqli_error($conn)); $row = mysqli_fetch_assoc($sql); $discount_amount = $rowo['discount_amount']; $totalAmount = $row['total_amount']-$discount_amount; if($row['total_amount']<$order_amount){ $shippingAmount=$shipping_charge; } if(isset($_SESSION['customer_id'])){ $customerID = $_SESSION['customer_id']; }else{ $customerID = 0; } /*$sqla=mysqli_query($conn,"select * from $tblShippingAddress where customer_id='$customerID'")or die(mysqli_error($conn)); if(mysqli_num_rows($sqla)>0){ $rowa = mysqli_fetch_assoc($sqla); $state = $rowa['state']; $city = $rowa['city']; $landmark = $rowa['landmark']; $address = $rowa['address']; $pincode = $rowa['pincode']; $localarea = $rowa['localarea']; }else{*/ $state = ""; $city = ""; $landmark = ""; $address = ""; $pincode = ""; $localarea =""; // } ?> <div class="col-lg-7"> <div class="account-card"> <div class="account-title"> <h4>Shipping Details</h4> </div> <div class="account-content"> <!-- action="payment.php" --> <form method="post" id='frmorderplace'> <div class="row"> <input type='hidden' id='amount' value='<?= $totalAmount+$shippingAmount ?>'> <input type='hidden' name="action" value='placeOrder'> <!-- <input type="hidden" name="shipping_charge" value="0"> <input type="hidden" name="order_amount" value="<?= $totalAmount ?>"> <input type="hidden" name="product_id" value="<?= $productID ?>"> <input type="hidden" name="product_name" value="<?= $rowd['name'] ?>"> <input type="hidden" name="product_price" value="<?= $product_price ?>"> <input type="hidden" name="quantity" value="<?= $quantity ?>"> --> <input type="hidden" id='getshipping' name="shipping_charge" value="<?= $shippingAmount ?>"> <input type="hidden" id='gettotal' name="order_amount" value="<?= $totalAmount ?>"> <input type="hidden" name="order_id" value="<?= $orderKey ?>"> <!-- ================================= --> <div class="col-lg-4 col-md-12"> <div class="form-group"> <label class="control-label">Full Name*</label> <input id="name" name="name" type="text" placeholder="Name" class="form-control input-md" required="" value=""> </div> </div> <div class="col-lg-4 col-md-12"> <div class="form-group"> <label class="control-label">Email Address*</label> <input id="email1" name="email" value="" type="text" placeholder="Email Address" class="form-control input-md" required=""> </div> </div> <div class="col-lg-4 col-md-12"> <div class="form-group"> <label class="control-label">Phone*</label> <input id="email1" name="phone" value="" type="text" placeholder="Phone" class="form-control input-md" required=""> </div> </div> <div class="col-lg-12 col-md-12"> <div class="form-group"> <label class="control-label">Address *</label> <input id="flat" name="address" type="text" placeholder="Address" class="form-control input-md" required="" value=""> </div> </div> <div class="col-sm-4 col-xs-12"> <div class="form-group"> <label class="control-label">Pincode*</label> <input id="street" value="" name="pincode" type="text" placeholder="Pincode" class="form-control input-md"> </div> </div> <div class="col-sm-8 col-xs-12"> <div class="form-group"> <label class="control-label">Landmark*</label> <input id="street" value="" name="landmark" type="text" placeholder="Landmark" class="form-control input-md"> </div> </div> <div class="col-lg-6 col-md-12"> <div class="form-group"> <label class="control-label">City*</label> <input id="pincode" name="city" type="text" placeholder="City" class="form-control input-md" value="" required=""> </div> </div> <div class="col-lg-6 col-md-12"> <div class="form-group"> <label class="control-label">State*</label> <input id="pincode" name="state" type="text" placeholder="State" class="form-control input-md" value="" required=""> </div> </div> <!-- ============ --> <!-- <div class="row"> <div class="col-md-12"> <div class="rpt100"> <ul class="radio--group-inline-container_1"> <li> <div class="radio-item_1"> <input id="cashondelivery1" value="1" name="mode" type="radio" data-minimum="50.0"> <label for="cashondelivery1" class="radio-label_1">Cash on Delivery</label> </div> </li> <li> <div class="radio-item_1"> <input id="card1" value="2" name="mode" type="radio" data-minimum="50.0" checked> <label for="card1" class="radio-label_1" >Online Payment</label> </div> </li> </ul> </div> </div> </div> --> </div> <!-- =========== --> <div class="col-lg-12 col-md-12"> <div class="form-group"> <div class="checkout-proced"> <br> <button type="submit" id='pay-btn' class="btn btn-inline ">Pay Now</button> </div> </div> </div> <!-- ================================= --> </div> </form> </div> </div> <div class="col-lg-5"> <div class="account-card"> <div class="account-title"> <h4>Your order</h4> </div> <div class="account-content"> <?php /*$flag=1; $sql1 = mysqli_query($conn,"select * from tbl_order where order_id = '$orderKey' ") or die(mysqli_error($conn)); $row1 = mysqli_fetch_assoc($sql1); $promo_amount=$row1['promo_amount']; $promo_type=$row1['promo_type']; $promocode=$row1['promo_code']; $discount =$row1['discount']; if($row1['promo_code']!=""){?> <div class="chekout-coupon"> <form id="frmapplypromo" class="coupon-form" style="display: flex;"> <input readonly="" id="getpromocode" value="<?= $row1['promo_code'] ?>" type="text" name="promocode" placeholder="Enter your coupon code" class=""> <button class="removepromocode" type="button"> <span>X Remove</span> </button> </form> </div> <?php }else{ $flag=0; $promo_amount="";$promo_type="";$promocode="";$discount=""; ?> <div class="chekout-coupon"> <form id="frmapplypromo" class="coupon-form" style="display: flex;"> <input id="getpromocode" type="text" name="promocode" placeholder="Enter your coupon code" class=""> <button class="applypromo" type="submit"> <span>apply</span> </button> </form> </div> <?php }*/ ?> <div class="table-scroll table-responsive"> <table class="table-list"> <thead> <tr> <th scope="col">#</th> <th scope="col"></th> <th scope="col">Product</th> <th scope="col">Total</th> </tr> </thead> <tbody> <?php $i=1; $sqlc=mysqli_query($conn,"select (select name from $tblProduct where id=o.product_id ) as product_name, (select thumb1 from $tblProduct where id=o.product_id ) as product_image, (select url from $tblProduct where id=o.product_id ) as product_url, o.* from tbl_order_details o where order_id='$orderKey' ") or die(mysqli_error($conn)); if(mysqli_num_rows($sqlc)>0){ while($rowc = mysqli_fetch_assoc($sqlc)){ ?> <tr> <td class="table-serial"> <h6><?= $i++ ?></h6> </td> <td class="table-image"> <img style="width:50px; height: auto" src="media/image/thumb/<?= $rowc['product_image'] ?>" alt="product"></td> <td class="table-name text-left"> <h6 style='font-weight: 500;font-size: 12px;'><?= $rowc['product_name'] ?><br> <span class="text-danger">Price: </span><?= $rowc['sale_price'] ?> x <?= $rowc['quantity'] ?> <br> </h6> </td> <td class="table-quantity table-action"> <h6>Rs. <?= $rowc['total'] ?> </h6> </td> </tr> <?php } } ?> <tr> <th colspan="3" class="table-serial total"> <h6>Total</h6> </td> <th class="table-quantity table-action" style="padding:10px;background: #f1f1f1"> <h6 class="text-success">Rs. <?= $totalAmount ?></h6> </th> </tr> <?php if($shippingAmount>0){?> <tr> <th colspan="3" class="table-serial total"> <h6>Shipping</h6> </td> <th class="table-quantity table-action" style="padding:10px;background: #f1f1f1"> <h6 class="text-success"><?= $shippingAmount ?></h6> </th> </tr> <?php }else{?> <tr> <th colspan="3" class="table-serial total"> <h6>Shipping</h6> </td> <th class="table-quantity table-action" style="padding:10px;background: #f1f1f1"> <h6 class="text-success">Free</h6> </th> </tr> <?php } ?> <tr> <th colspan="3" style="text-align: right !important;padding:10px;background: #f1f1f1" class="table-serial"> <h6>Payble</h6> </td> <th class="table-quantity table-action" style="padding:10px;background: #f1f1f1"> <h6 class="text-success">Rs. <?= $totalAmount+$shippingAmount ?> </h6> </th> </tr> </tbody> </table> </div> <div class="chekout-coupon"> <!-- <button class="coupon-btn">Do you have a coupon code?</button> --> <form class="coupon-form"> <input type="text" placeholder="Enter your coupon code"> <button type="submit"> <span>apply</span> </button> </form> </div> <!-- ============ --> <!-- ========== --> </div> </div> </div> </div> </div> </section> <?php include'include/footer.php'; include'include/footer-file.php';?> </body> </html> <script src="https://checkout.razorpay.com/v1/checkout.js"></script> <script> $(document).ready(function () { $("#pay-btn").click(function () { var amount = $("#amount").val(); // Get the entered amount if (amount <= 0 || isNaN(amount)) { alert("Please enter a valid amount"); return; } $.ajax({ url: "razorpay/create_order.php", type: "POST", data: { amount: amount }, dataType: "json", success: function (response) { console.log("Order Response:", response); if (!response.id) { alert("Error creating order. Please check server response."); return; } var options = { "key": "rzp_live_GcsvobdabOzpDd", "amount": response.amount, // Use dynamic amount "currency": "INR", "name": "Mkoi Homeo Care", "description": "Test Transaction", "order_id": response.id, "handler": function (paymentResponse) { console.log("Payment Success:", paymentResponse); // Debugging $.ajax({ url: "razorpay/verify_payment.php", type: "POST", data: { razorpay_payment_id: paymentResponse.razorpay_payment_id, razorpay_order_id: paymentResponse.razorpay_order_id, razorpay_signature: paymentResponse.razorpay_signature }, success: function (res) { console.log("Verification Response:", res); alert("Payment Successful"); window.location.href='success.php'; }, error: function (err) { console.log("Verification Error:", err); alert("Payment verification failed."); } }); }, "theme": { "color": "#3399cc" } }; var rzp1 = new Razorpay(options); rzp1.open(); }, error: function (xhr, status, error) { console.log("Order Creation Error:", xhr.responseText); alert("Failed to create order. Check console for details."); } }); }); }); </script> <style> .breadcrumb-item + .breadcrumb-item::before { float: left; padding-right: .5rem; color: #6c757d; content: var(--bs-breadcrumb-divider,"/"); } .single-banner { background-size: cover !important; padding: 45px 0px; text-align: center; position: relative; z-index: 1; } tbody tr td { padding: 4px 10px; text-align: left !important; border-right: 1px solid var(--border); font-size: 12px; } thead tr th { font-size: 17px; font-weight: 500; white-space: nowrap; text-align: left; } .main-total-cart{ padding: 15px; } .total{ text-align: right !important;padding:10px;background: #f1f1f1 } </style>