Preview: checkout.php
Size: 14.01 KB
/home/justbyquicklly-old/justbyquicklly/www/js/checkout.php
<?php
include("wfcart.php");
include("include/config.php");
include("include/functions.php");
include("include/sessionmsg.php");
$cart =& $_SESSION['cart'];
if(!is_object($cart)) $cart = new wfCart();
if($_SESSION['value_user_id']==''){
header("location:login.php?redirect=basket.php");
exit();
}
if($_REQUEST['submitForm']=='yes'){
$delivery_type=mysql_real_escape_string($_REQUEST['delivery_type']);
$specmsg=mysql_real_escape_string($_REQUEST['specmsg']);
$payment_mode=mysql_real_escape_string($_REQUEST['payment_mode']);
$_SESSION['delivery_type']=$delivery_type;
$_SESSION['special_msg']=$specmsg;
$_SESSION['payment_mode']=$payment_mode;
$_SESSION['cart_value']=$cart->total;
header("location:review.php");
exit();
}
if($_REQUEST['apply_coupon']=='yes'){
if($_REQUEST['evcode']==1){
$coupon=mysql_real_escape_string($_REQUEST['coupon']);
$cArr=$obj->query("select * from $tbl_coupon where coupon_code='$coupon' and minimum_purchase<='".$cart->total."' and status=1 and expire_date>='".date('Y-m-d')."' ");
if($obj->numRows($cArr)){
$rsCoupon=$obj->fetchNextObject($cArr);
if($rsCoupon->valid_for=='All'){
$_SESSION['discountCoupon']=$rsCoupon->id;
}
if($rsCoupon->valid_for=='Particular'){
if($rsCoupon->to_email==$_SESSION['value_user_email']){
$_SESSION['discountCoupon']=$rsCoupon->id;
}else{
$_SESSION['coupon_error']="Invalid Coupon.!";
}
}
}else{
$_SESSION['coupon_error']="Invalid Coupon.!";
}
}
if($_REQUEST['evcode']==2){
$rewardpoint=mysql_real_escape_string($_REQUEST['rewardpoint']);
if($cart->total>$rewardpoint){
$my_rewarspoint=getRewardPoints($_SESSION['value_user_id']);
if($my_rewarspoint>=$rewardpoint){
$obj->query("insert into $tbl_reward_history set user_id='".$_SESSION['value_user_id']."',reward_point='$rewardpoint',type='Dr',added_date=now(),status=1 ");
$_SESSION['discountReward']=$rewardpoint;
$_SESSION['coupon_error']="Invalid Coupon.!";
}else{
$_SESSION['coupon_error']="Invalid Reward Point!";
}
}else{
$_SESSION['coupon_error']="Reward Point not greater then Sub Total.!";
}
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Checkout</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="fonts/font.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600' rel='stylesheet' type='text/css'>
<style type="text/css">
.uiv2-all-slot-timings .uiv2-not-available {
background-color: #d1d3d4;
border: 1px solid #d1d3d4;
}
.uiv2-all-slot-timings .uiv2-not-available:hover {
cursor: default;
outline: medium none;
}
</style>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#couponfrm").validate();
$("#deliveryexptimeshow").hide();
$('#dslot2').hide();
$("#deliverychrgremove").hide();
$("#specialdeliverychrgadd").hide();
$("#specialdeliverychrg").hide();
$("#rewardpointcode").hide();
$('#rewardpoint').removeClass('required');
});
</script>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- google analytics code-->
<?php include_once("analyticstracking.php") ?>
</head>
<body>
<?php include("head-top.php"); ?>
<div class="container" style="border:1px solid #ccc">
<div class="col-md-12"><h4><br>CHECKOUT</h4><hr style="border:1px solid #999"></div>
<div class="col-md-9 col-sm-12" style="border:1px solid #999; border-radius:4px">
<form name="frm" method="post" action="">
<input type="hidden" name="submitForm" value="yes">
<div class="col-md-8 col-sm-12"><h5>Delivery address <i class="fa fa-map-marker" aria-hidden="true" style="color:#F66"></i></h5></div>
<div class="col-md-4 col-sm-12"><a href="change-update-profile.php?redirect=checkout.php" class="Userguest">Change Address <i class="fa fa-pencil" aria-hidden="true"></i></a></div>
<div class="col-md-12" style="border-top:1px solid #ddd"><?php $userArr=$obj->query("select * from $tbl_user where id='".$_SESSION['value_user_id']."'");
$resultUser=$obj->fetchNextObject($userArr); ?>
<p style="font-weight:700"><?php echo stripslashes($resultUser->fname)." ".stripslashes($resultUser->lname); ?></p>
<p><?php echo stripslashes($resultUser->house_no);?> <?php echo stripslashes($resultUser->street); ?> <?php echo stripslashes($resultUser->complex); ?> <?php echo stripslashes($resultUser->landmark); ?></p>
<p><?php echo stripslashes($resultUser->area); ?> <?php echo getField('city',$tbl_city,$resultUser->city_id); ?> - <?php echo stripslashes($resultUser->pincode); ?></p>
<p>Contact no: <?php echo stripslashes($resultUser->mobile); ?></p>
</div>
<br>
<div class="col-md-12" style="border-top:1px solid #999">
<h5><br>Special Message <i class="fa fa-file-text-o" style="color:#FC9" aria-hidden="true"></i></h5><br>
<textarea name="specmsg" cols="2" rows="5" placeholder="500 Characters only" style="border:#ccc 1px solid; border-radius:4px" ></textarea></div>
<p> </p>
<div class="col-md-12 col-sm-12" style="border:1px solid #999; border-radius:4px">
<br><h5>Delivery Options</h5><hr>
<input type="radio" name="delivery_type" checked onClick="$('#dslot').show(); $('#dslot2').hide(); $('#deliverychrgremove').hide(); $('#deliverychrgadd').show(); $('#deliverychrg').show(); $('.showondelivery').show();" value="Delivery">
Home Delivery (Wednesday & Saturday)<br>
<input type="radio" name="delivery_type" onClick="$('#dslot').hide(); $('#dslot2').show(); $('#deliverychrgremove').show(); $('#deliverychrgadd').hide(); $('#deliverychrg').hide(); $('#specialdeliverychrgadd').hide(); $('#specialdeliverychrg').hide(); $('.showondelivery').hide();" value="Pick">
Pick up From Freshfarms
<br><br>
<div class="" id="dslot" >
<div id="deliverystandtimeshow">
Delivered on Wednesday & Saturday between 5.00pm - 10.00pm CT
</div>
</div>
<div class="delivery-slot-container checkout-bdr" id="dslot2" >
<h5 class="small-head"> Fresh Farms Address</h5>
<div id="deliverystandtimeshow" style="padding:15px">
<div class="next-n-slots"> <br>
<?php $storeadd=$obj->query("select storeaddress, minimum, fee from stores where storeid=100");
$addres=$obj->fetchNextObject($storeadd);
echo $addres->storeaddress; ?> </div><br>
</div>
</div>
<br>
<br>
<input type="hidden" checked name="payment_mode" value="Online"/>
*See <a href="term-&-condition.php" target="_blank">terms and conditions</a>
<input type="submit" class="Userguest" value="REVIEW & PLACE ORDER" style="float:right; width:220px" />
<p> </p>
</div>
</form></div>
<div class="col-md-3 col-sm-12">
<?php if($_SESSION['discountCoupon']=='' && $_SESSION['discountReward']==''){ ?>
<form name="couponfrm" id="couponfrm" method="post" action="">
<input type="hidden" name="apply_coupon" value="yes" >
<div class="options">
<span style="color:#333"> <input type="radio" name="evcode" checked value="1" onChange="$('#evouchercode').show(); $('#rewardpointcode').hide(); $('#rewardpoint').removeClass('required'); $('#coupon').addClass('required');"> <label>eVoucher</label></span>
<span style="color:#333"> <input type="radio" name="evcode" value="2" onChange="$('#evouchercode').hide(); $('#rewardpointcode').show(); $('#coupon').removeClass('required'); $('#rewardpoint').addClass('required');"> <label>Reward Point (<?php echo $rewarspoint=getRewardPoints($_SESSION['value_user_id']);?>)</label></span>
</div>
<div class="apply-voucher" id="evouchercode" style="border:1px solid #999; padding:10px">
<p style="font-weight:bold">Your eVoucher Code (optional) *</p>
<div align="center" style="color:#C00;"><?php echo $_SESSION['coupon_error'];$_SESSION['coupon_error']=''; ?></div>
<input type="text" name="coupon" id="coupon" value="" class="required form-control" style="border:1px solid #ddd; height:35px"/><br>
<a href="javascript:void(0)" onClick="$('#couponfrm').submit();" class="guestUser">apply</a>
<p>* A maximum of one voucher is applicable for an order.</p>
</div>
<div class="apply-voucher" id="rewardpointcode" style="border:1px solid #ccc; padding:10px">
<p>Your Reward Point (optional) *</p>
<div align="center" style="color:#C00;"><?php echo $_SESSION['coupon_error'];$_SESSION['coupon_error']=''; ?></div>
<input type="text" name="rewardpoint" id="rewardpoint" value="" class="required digits form-control" style="border:1px solid #ddd; height:35px"/><br>
<a href="javascript:void(0)" onClick="$('#couponfrm').submit();" class="guestUser">apply</a>
<p>* Reward point aplicable .</p>
</div>
</form>
<?php } ?>
<br>
<div class="order-summary" style="border:1px solid #999; padding:10px; color:#333">
<h5 style="font-weight:bold; color:#333">Order Summary</h5><br>
<ul>
<li><span style="color:#333">Subtotal</span>
<p><?php $_SESSION['netamt']=number_format(($_SESSION['net_tax']+$cart->total),2); echo $_SESSION['netamt'];?></p>
</li>
<?php
$discount=0;
if($_SESSION['discountCoupon']!=''){
$discArr=$obj->query("select discount_type,discount from $tbl_coupon where id='".$_SESSION['discountCoupon']."' ");
$rsCoup=$obj->fetchNextObject($discArr);
if($rsCoup->discount_type=='Percent'){
$discount=($cart->total*$rsCoup->discount)/100;
}
if($rsCoup->discount_type=='Direct'){
$discount=$rsCoup->discount;
}
?>
<li><span style="color:#333;">Coupon Discount</span>
<p><?php echo $website_currency_symbol;?> <?php echo number_format($discount,2);?></p>
</li>
<?php }
if($_SESSION['discountReward']!=''){
$discount=$_SESSION['discountReward'];
?>
<li><span style="color:#333;">Reward Point Discount</span>
<p><?php echo $website_currency_symbol;?> <?php echo number_format($discount,2);?></p>
</li>
<?php }?>
<li id="deliverychrg"><span style="color:#333;"><strong>Delivery Charge </strong></span>
<p><?php echo $website_currency_symbol;?>
<?php if($addres->minimum>$cart->total){
$delivery_charges=$addres->fee;
$_SESSION['delivery_charges']=$delivery_charges;
}else{
$delivery_charges=getFieldid('shippingamount',$tbl_setting,1);
$_SESSION['delivery_charges']=getFieldid('shippingamount',$tbl_setting,1);
}
echo $delivery_charges;?>
</p>
</li>
<li id="deliverychrgadd"><span style="color:#333;"><strong>AMOUNT TO PAY</strong></span>
<p class="amount-to-Pay-total"><?php echo $website_currency_symbol;?>
<?php $total_amount=$_SESSION['netamt']+$delivery_charges-$discount;
echo number_format($total_amount,2);?>
</p>
</li>
<li id="deliverychrgremove"><span style="color:#333"><strong>AMOUNT TO PAY</strong></span>
<p class="amount-to-Pay-total"><?php echo $website_currency_symbol;?>
<?php $total_amount=$_SESSION['netamt']-$discount;
echo number_format($total_amount,2);?>
</p>
</li>
<li id="specialdeliverychrgadd"><span><strong>AMOUNT TO PAY</strong></span>
<p class="amount-to-Pay-total"><?php echo $website_currency_symbol;?>
<?php
$expamt = getField('expressdeliveryamount','tbl_setting',1);
$total_amount=$_SESSION['netamt']+$expamt-$discount;
echo number_format($total_amount,2);?>
</p>
</li>
</ul>
<div class="clear"></div>
<?php
if($_SESSION['yoursaving']!=0){ ?>
<div class="you-saved">You Saved <?php echo $website_currency_symbol;?> <?php echo number_format($_SESSION['yoursaving'],2); ?></div>
<?php } ?>
</div>
</div>
</div>
<div class="clearfix"></div><br>
<?php include("footerin.php"); ?>
</div>
</div>
</body>
</html>
Directory Contents
Dirs: 1 × Files: 76