[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: cart.php
<?php include('header.php'); $insert=new Oops($db);?> <script src="jquery-1.11.1.min.js"></script> <style> .sweet-alert h2{ font-size: 16px; } </style> <!-- BANNER --> <div class="banner-inner"> <img src="images/inner-banner.jpg" alt="" class="banner-img"> </div> <script> function check(){ var radioValue = $("input[name='del_type']:checked").length; //alert(radioValue); if(radioValue==0){ swal('Please select any delivery option'); $("input[name='del_type']").prop('required',true); return false; }else{ return true; } } </script> <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=(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("<small>Max Discount of Rs "+max_discount+" applied</small>"); $('#discount').show(); $('#discount').val(disval);//alert(disval); calc_total(); $('#promo_apply').hide(); }else{ $("#exist_c").html("<small>Discount of Rs "+disval+" applied</small>"); $('#discount').show(); $('#discount').val(disval);//alert(disval); calc_total(); $('#promo_apply').hide(); } }else{ alert('This Promocode expired');} } }); }else alert('Please Provide promocode');$('#promo').val(''); }); </script> <!-- check-out / CART --> <div class="check-out"> <div class="container"> <h3>Cart</h3> <form action="" onsubmit="" method="post"> <div class="table-responsive"> <table class="table"> <tbody> <tr> <th class="t-head head-it ">Food</th> <th class="t-head">Price</th> <th class="t-head">Quantity</th> <th class="t-head">Total Price</th> <th class="t-head">Remove</th> </tr> <?php if(isset($_SESSION["cart_item"])){ $item_total = 0; ?> <?php $cn=0; foreach ($_SESSION["cart_item"] as $item){ //print_r($item); $item_total += ($item["price"]*$item["quantity"]); ?> <script> var a="#val"+<?=$cn?>; $(document).on('click', '#val<?=$cn?>' ,function(){ var p=$('#ori_price<?=$cn?>').val(); var divUpd = $(this).parent().find('#value<?=$cn?>'), newVal = parseInt(divUpd.text(), 10)+1; divUpd.text(newVal); $('#qty<?=$cn?>').val(newVal); var newprice= newVal*p; $('#c_price<?=$cn?>').val(newprice); $('#total').val(newprice); calc_total(); $( "#promocode111" ).load( "cart.php #promocode" ); //$( "#promo" ).unbind(); }); /*$('#val_min<?=$cn?>').on('click', function(){*/ $(document).on('click', '#val_min<?=$cn?>' ,function(){ var p=$('#ori_price<?=$cn?>').val(); var divUpd = $(this).parent().find('#value<?=$cn?>'), newVal = parseInt(divUpd.text(), 10)-1; if(newVal>=1){ divUpd.text(newVal); $('#qty<?=$cn?>').val(newVal); var newprice= newVal*p; $('#c_price<?=$cn?>').val(newprice); calc_total(); $( "#promocode111" ).load( "cart.php #promocode" ); } }); function calc_total(){ var sum = 0; var amt=parseInt(40); //alert(amt); var discount=parseInt($('#discount').val()); $(".total").each(function(){ //var t= $('.total').val();alert(t); sum += parseFloat($(this).val()); }); $('#sub_tot').val(sum); var gst=Math.round(.05*sum); //alert(gst); var grand_total=Math.round(.05*sum)+(sum)+amt-discount; $('#gtotal').val(grand_total); $('#gst').val(gst); } </script> <tr class="cross"> <td class="ring-in t-data"> <div class="sed2"> <a href="single.php" class="at-in"> <img src="<?=$pic_img?>/<?=$item['img']?>" class="img-responsive" alt=""> </a> </div> <div class="sed"> <h5><input type="text" name="product_name[]" value="<?=$item["product_name"]; ?>" readonly /></h5> </div> <div class="clearfix"> </div> </td> <td class="t-data"><input type="text" name="price[]" value="<?=$item["price"]; ?>" readonly /></td> <td class="t-data"> <div class="quantity"> <div class="quantity-select"> <div class="entry value-minus" id="val_min<?=$cn?>"> </div> <div class="entry value" id="value<?=$cn?>"><?=$item["quantity"]; ?></div> <div class="entry value-plus active" id="val<?=$cn?>"> </div> <input type="hidden" name="qty[]" id="qty<?=$cn?>" value="<?=$item["quantity"]; ?>"/> <input type="hidden" name="" id="ori_price<?=$cn?>" value="<?=$item["price"]; ?>"/> <input type="hidden" name="code[]" value="<?=$item["code"]; ?>"/> <input type="hidden" name="maker_id" value="<?=$item["maker_id"]; ?>"/> <input type="hidden" name="comi_percent" value="<?=$item["comi_percent"]; ?>"/> </div> </div> </td> <td class="t-data"><input type="text" name="totalp[]" id="c_price<?=$cn?>" class="total" value="<?=$item["price"]; ?>" readonly /></td> <td class="ring-in t-data"> <div class="close1"> <a href="cart.php?action=remove&code=<?php echo $item["code"]; ?>&size=<?php echo $item["size"]; ?>" class="button" ><i class="fa fa-times" aria-hidden="true"></i></a> </div></td> </tr> <?php // $item["price"]=explode("Rs",$item["price"]); $cn++; } echo"<input type='hidden' id='total' value='$item_total' name='tot'>"; ?> <?php } $gst=.05*$item_total; ?> <div class="clearfix"> </div> </tbody> </table> </div> <div class="subtotal"> <span id="sum"></span> <div class="totall"> <label>Subtotal Rs : </label><input type="text" name="sub_tot" id="sub_tot" value="<?=$item_total?>" readonly=""> <label> GST (Round off) : </label><input type="text" name="gst" id="gst" value="<?=round($gst)?>" readonly> <!--- <label for="delivery">Delivery :</label> <input type="radio" id="delivery" name="del_type" value="delivery" style="margin: 10px 0 0;"> <br> <label for="pickup">Self-Pickup</label> <input type="radio" id="pickup" name="del_type" value="pickup" style="margin: 10px 0 0;"> <input type="hidden" id="del_amt" name="del_amt" value="40"> -----> <input type="hidden" id="del_amt" name="del_amt" value="40"> <div id="delv" style="display:"> <label id="show_del" ><small>Delivery charge Rs :</small></label><input type="text" name="delivery_chrge" id="delivery_chrge" value="40"> </div> <!--- <?php if(isset($_SESSION['login_id']) && !empty($_SESSION['login_id'])) {?> <div id="promocode111" style="display:"> <div id="promocode"> <small><label>Promo code(If Any) : </label><input type="text" name="promo" id="promo" placeholder="Promocode" style="border-bottom: 1px dotted #000;"> <input type="hidden" id="discount" name="promo_discount" value='0'> <button class="button" id="promo_apply" type="button">Apply</button> </small> <div id="exist_c"></div> </div> </div> <?php }else{ ?> <small><a href="login.php?pg=<?=base64_encode($_SERVER['REQUEST_URI'])?>">Login To See promocode</a></small> <input type="hidden" id="discount" value='0'> <?php } ?> --> <label> Total Rs : </label> <input type="text" name="total" id="gtotal" value="<?=$item_total+round($gst)+intval(40)?>" readonly> <br> </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); } $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'], 'total'=>$_POST['total'], 'maker_id'=>$_POST['maker_id'], 'promo_code'=>$_POST['promo'], 'promo_code_val'=>$_POST['promo_discount'] ); // print_r($data2); echo "<br>"; $tot=intval($_POST['tot']); $comi_percent=$_POST['comi_percent']; $comm_amt= ($comi_percent/100)* ((($_POST['gst']/100)*$_POST['total'])+$_POST['total']); $data1_c=array( 'book_id'=>$oid, 'gross_total'=>$_POST['total'], '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> <script src="js/jquery.min.js"></script> <!-- //js --> <!-- cart --> <script src="js/simpleCart.min.js"></script> <script>$(document).ready(function(c) { $('.close1').on('click', function(c){ $('.cross').fadeOut('slow', function(c){ $('.cross').remove(); }); }); }); </script> <script>$(document).ready(function(c) { $('.close2').on('click', function(c){ $('.cross1').fadeOut('slow', function(c){ $('.cross1').remove(); }); }); }); </script> <script>$(document).ready(function(c) { $('.close3').on('click', function(c){ $('.cross2').fadeOut('slow', function(c){ $('.cross2').remove(); }); }); }); $(document).ready(function(){ $("input[type='radio']").on('click', function(){ var radioValue = $("input[name='del_type']:checked").val(); var gtotal = $("#gtotal").val(); var deli=parseFloat($("#delivery_chrge").val()); //alert(deli); if(radioValue=='pickup'){ var gt=gtotal-deli; $("#gtotal").val(gt); // $("#show_del").html("<small>Additional discount for self-pickup Rs:</small>"); $("#delivery_chrge").val(0); }else{ $("#show_del").html("<small>Delivery charge Rs :</small>"); $("#delivery_chrge").val(40); $("#delv").show(); calc_total(); } $('#promocode111').show(); }); }); </script> <style> .check-out .totall input::placeholder { color: red; opacity: 1; /* Firefox */ } .check-out .totall input:-ms-input-placeholder { /* Internet Explorer 10-11 */ color: red; } .check-out .totall input::-ms-input-placeholder { /* Microsoft Edge */ color: red; } </style> <?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: 678.04 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