[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: add-cart.php
<?php include('header.php'); $insert=new Oops($db);?> <script src="js/jquery-1.11.1.min.js"></script> <style> .sweet-alert h2{ font-size: 16px; } </style> <script> $(document).on('click', '#promo_apply' ,function(){ if($("#promo").prop('required',true)){ var promo=$('#promo').val(); var user="<?=$_SESSION['login_id']?>"; alert(promo); var sub_tot=parseFloat($('#sub_tot').val()); $.ajax({ type:"POST", url:"ajax_check.php", data:"promo="+promo+"&user="+user, dataType: 'JSON', success: function (response){ // $('#exist_c').html(response).show(); if(response.applicable=='YES'){ var discount = response.discount; var max_discount = response.max_discount; var min_amount = parseFloat(response.min_amount); var disval=Math.round((discount/100)*sub_tot); if(min_amount>sub_tot){ swal('Promo Not appilcable, Min order value ='+min_amount); } else if(max_discount<disval){ $("#exist_c").html("<p>Max Discount of Rs "+max_discount+" applied</p>"); $('#discount').show(); $('#discount').val(disval);//alert(disval); calculateSum(); $('#promo_apply').hide(); }else{ $("#exist_c").html("<p>Discount of Rs "+disval+" applied</p>"); $('#discount').show(); $('#discount').val(disval);//alert(disval); calculateSum(); $('#promo_apply').hide(); } }else{ alert('This Promocode expired');} } }); }else alert('Please Provide promocode');$('#promo').val(''); }); </script> <!-- BANNER --> <div class="banner-inner" style="height: 170px;"> <img src="images/inner-banner.jpg" alt="" class="banner-img"> </div> <div class="check-out"> <div class="container"> <div class="title-section text-center"> <p class="w3ls-title-sub"> Cart </p> <h3 class="w3ls-title">Check <span> Out</span></h3> </div> <form method="post" enctype="multipart/form-data"> <div class="checkout-left-box"> <?php $count_add=1; if(isset($_SESSION["cart_item"])){ $item_total = 0;$item_gst=0; ?> <?php foreach ($_SESSION["cart_item"] as $item){ //print_r($item); ?> <script> $(document).ready(function(){ $("#qty<?php echo $count_add; ?>").change(function(){ var qty =$("#qty<?php echo $count_add; ?>").val();//alert(qty); var code =$("#code<?php echo $count_add; ?>").val(); var price =$("#price<?php echo $count_add; ?>").val(); var pack =$("#packaging<?php echo $count_add; ?>").val(); var gprice = qty*price; var total_ori = qty*price; var total_pack = qty*pack; var gst=.05*total_ori; var pack_gst=.05*total_pack;//alert(pack_gst); var total_gst=parseFloat(gst)+parseFloat(pack_gst);//alert(total_gst); var total_dis = total_ori-gprice; var total=gprice+gst+parseInt(40); var valueinshow="₹ "+price+"*"+qty+"=₹ "+gprice; $.ajax({ type: "POST", url: "cart_update.php", data: "qty="+qty+"&code="+code+"&price="+price, cache: false, success: function(result){ a=result; $("#gprice<?php echo $count_add; ?>").val(gprice); $("#sub_tot").val(total); $("#quantity<?php echo $count_add; ?>").val(qty); $("#base_total").val(gprice); $("#show_price").html("₹"+total); $("#main_total").html("₹"+total_ori); $("#gst_span").html("₹"+gst); $("#gst").val(total_gst); $("#total_gst<?php echo $count_add; ?>").val(total_gst); $("#dis").html("-₹"+total_dis); $("#valueinshow<?php echo $count_add; ?>").html(valueinshow); calculateSum(); } }); }); }); function calculateSum(){ var sum = 0;var sum_gst=0; var amt=parseInt(40); //alert(amt); var discount=parseInt($('#discount').val()); $(".gprice").each(function(){ // var t=$('.gprice').val(); sum += parseFloat($(this).val()); }); $(".total_gst").each(function(){ // var t=$('.gprice').val(); sum_gst += parseFloat($(this).val()); }); //alert(sum_gst); $("#main_total").html("₹"+sum); $("#tot").val(sum); $('#sub_tot').val(sum); var gst=sum_gst; //alert(gst); var grand_total=(gst+sum+parseInt(40)+parseInt(4))-discount; //alert(grand_total); $('#gtotal').val(grand_total); $('#gst').val(gst); $("#gst_span").html("₹"+gst); $("#show_price").html("₹"+grand_total); $('#sub_tot').val(grand_total); } </script> <?php //echo $_SESSION['login_user'] ?> <div class="checkout-box-block"> <div class="checkout-image-content"> <a href="single-product.php"> <img src="<?=$pic_img?>/<?=$item["img"]; ?>" alt=""> </a> </div> <div class="checkout-dec-content"> <h4><?=$item["product_name"]; ?></h4> <input type="hidden" name="product_name[]" value="<?=$item["product_name"]; ?>" readonly /> <input type="hidden" name="price[]" id="price<?=$count_add;?>" value="<?=$item["price"]; ?>" readonly /> <input type="hidden" name="code[]" id="code<?=$count_add;?>" value="<?php echo $item["menu_id"]; ?>" readonly /> <input type="hidden" name="totalp[]" class="gprice" id="gprice<?php echo $count_add; ?>" value="<?php echo $item["price"]; ?>" readonly /> <input type="hidden" name="ori_price[]" class="ori_price" id="ori_price<?php echo $count_add; ?>" value="<?php echo $item["price"]; ?>" readonly /> <input type="hidden" name="packaging[]" class="ori_price" id="packaging<?php echo $count_add; ?>" value="<?php echo $item["packaging"]; ?>" readonly /> <input type="hidden" name="comi_percent" value="<?=$item["comi_percent"]; ?>"/> <h5>₹ <?=$item["price"]; ?> </h5> <div class="quantity"> <label>Qty: </label> <select id="qty<?php echo $count_add; ?>" name="qty[]" > <?php for($i=1;$i<=10;$i++){ ?> <option value="<?=$i?>" <?php if($i==$qty) echo 'selected'; ?>><?=$i?></option> <?php }?> </select> <p id="valueinshow<?=$count_add;?>"> ₹ <?=$item['price']?>*<?=$item['quantity']?>=₹ <?=$item["price"]; ?> </p> <input type="hidden" name="maker_id" value="<?php echo $item["maker_id"]; ?>" readonly /> <input type="hidden" name="total_gst" class="total_gst" value="<?=$item["packaging"]*.05?>" id="total_gst<?php echo $count_add; ?>" /> </div> <div class="close"> <a href="add-cart.php?action=remove&code=<?php echo $item["menu_id"]; ?>" class="button" ><i class="fa fa-times" aria-hidden="true"></i></a> </div> </div> </div> <?php $item_total += ($item["price"]*$item["quantity"]); $item_gst += ($item["packaging"]*$item["quantity"]); ++$count_add; } echo"<input type='hidden' value='$item_total' id='tot' name='tot'>"; $dis +=($item["price"]-$item["price"]); $original_total +=($item["price"]*$item["quantity"]); } $gst=.05*$item_total; $gst_pack=.05*$item_gst; ?> </div> <div class="checkout-right-box"> <div class="total-checkout"> <p>Subtotal <span id="main_total">₹<?=$item_total?></span></p> <p> GST & Restaurant Charges <span id="gst_span">₹<?=($gst+$gst_pack)?></span> </p> <input type="hidden" name="gst" id="gst" value="<?=$gst+$gst_pack?>" > <input type="hidden" id="del_amt" name="del_amt" value="40"> </p> <p>Handling Charges (Standard)<span class="free">+ ₹40</span></p> <p>Convenience Charge<span class="free">+ ₹<?=$convenience?></span></p> <?php if(isset($_SESSION['login_id']) && !empty($_SESSION['login_id'])) {?> <div id="promocode111" style="display:"> <div id="promocode"> <p>Promo code(If Any) : </p> <div id="promocodeinput"> <input type="text" name="promo" id="promo" placeholder="Promocode" style=""> <input type="hidden" id="discount" name="promo_discount" value='0'> <button class="button" id="promo_apply" type="button">Apply</button> </div> <div id="exist_c"></div> </div> </div> <?php }else{ ?> <small><a href="user-login.php?pg=<?=base64_encode($_SERVER['REQUEST_URI'])?>">Login To See promocode</a></small> <input type="hidden" id="discount" value='0'> <?php } ?> <div class="price-breakup-final"> <p>Total Cost <span id="show_price">₹<?=$item_total+intval(40)+intval(4)+$gst+$gst_pack?></span> <input type="hidden" name="sub_tot" id="sub_tot" value="<?=$item_total+intval(40)+intval($convenience)+$gst+$gst_pack?>"> <input type="hidden" id="convenience" name="convenience" value="<?=$convenience?>"> </p> </div> </div> <div class="submit-chekout"> <input type="submit" value="CHECKOUT" name="sub" class="button"> </div> </div> </form> <?php if(isset($_POST['sub'])){ if(isset($_SESSION['login_id']) && !empty($_SESSION['login_id'])) { $sq_food=$show->readwithdata('food_maker','maker_id',$_POST['maker_id']); while($row=$sq_food->fetch(PDO::FETCH_ASSOC)){ $_SESSION['maker_lat']=$row['latitude']; $_SESSION['maker_long']=$row['longitude']; } $oid=$show->getid('ids','ORD'); $item_name=$_POST['product_name']; $item_code=$_POST['code']; $item_qty=$_POST['qty']; $item_price=$_POST['price']; $totalp=$_POST['totalp']; for($i = 0; $i < count($item_name); $i++){ $price =$item_price[$i]; //$total_p=intval($price*$item_qty[$i]); // $gst_value=($gst[$i]/100)*$total_p; $data=array( 'order_id'=>$oid, 'product_id'=>$item_code[$i], 'product_name'=>$item_name[$i], 'quantity'=>$item_qty[$i], 'price'=>$item_price[$i], 'order_time'=>date('Y-m-d h:i:s'), 'user_id'=>$_SESSION['login_id'], 'total'=>$totalp[$i], ); // print_r($data); echo "<br>"; $r=$insert->insert('bill',$data); } if($_POST['del_type']=='pickup'){ $del_char=0; $pickup=0; }else{ $del_char=40; $pickup=0; } $data2=array( 'order_id'=>$oid, 'amount'=>$_POST['sub_tot'], 'status'=>'Pending', 'user_id'=>$_SESSION['login_id'], 'client_name'=>$_SESSION['login_user'], 'email'=>$_SESSION['username'], 'gst'=>$_POST['gst'], 'delivery_charge'=>$del_char, 'delivery_type'=>$_POST['del_type'], 'self_pickup'=>$pickup, 'maker_id'=>$_POST['maker_id'], 'promo_code'=>$_POST['promo'], 'promo_code_val'=>$_POST['promo_discount'], 'convenience'=>$_POST['convenience'], 'total'=>$_POST['tot'], ); // print_r($data2); echo "<br>"; $tot=intval($_POST['tot']); $comi_percent=$_POST['comi_percent']; $comm_amt= ($comi_percent/100)* ($tot); $data1_c=array( 'book_id'=>$oid, 'gross_total'=>$_POST['tot'], 'total'=>$_POST['sub_tot'], 'commission_amt'=>$comm_amt, 'commission'=>$comi_percent, 'cook_id'=>$_POST['maker_id'], 'date'=>date('Y-m-d'), 'status'=>'PENDING', 'paid_status'=>'PENDING', ); // print_r($data1_c); echo "<br>"; $r1=$insert->insert('place_order',$data2); $r2=$insert->insert('sajh_comission',$data1_c); if($r1 && $r2){ $_SESSION['total']=$tot; echo "<script>window.location.href='checkout.php?order=".$oid."&sub_t=&no_of_p=".urlencode($item_qty[$i])."'</script>"; } } else { $url=$_SERVER['REQUEST_URI']; echo '<script> setTimeout(function() { swal({ title: "Oops!", text: "Please Login/Sign up to continue", type: "error" }, function() { swal("You will be redirected to Login page"); window.location = "user-login.php?pg='.base64_encode($url).'"; }); }, 1000); </script>'; } } ?> </div> </div> <?php include('footer.php');?>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.99 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: 1619