System: Windows NT WINDOWS18 10.0 build 17763 (Windows Server 2016) AMD64 | User: IWPD_3544(appclien)
Path: D:\Inetpub\vhosts\appclients.in\fruits-vegitables.nmvm.org
[Back to List]
<?php
error_reporting(0);
include "includes/main-action.php";
$obj=new admin_main();
$sel_cs=$obj->select_all("menu","order by menu_id");
$sel_banner_top=$obj->select_all("adv_tbl1","order by adv_id desc limit 1");
$sel_banner_right=$obj->select_all("adv_tbl3","order by adv_id desc limit 2");
$sel_slider=$obj->select_all("adv_tbl2","order by adv_id desc");
$max=count($_SESSION['cart']);
if($max==0)header('location:/');
// add product to cart
if($_REQUEST['command']=='delete' && $_REQUEST['pid']>0){
remove_product($_REQUEST['pid']);
}
else if($_REQUEST['command']=='clear'){
unset($_SESSION['cart']);
}
else if($_REQUEST['command']=='update'){
$max=count($_SESSION['cart']);
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
//$totalStock=$_REQUEST["totalStock$pid"];
$prodQty=$_REQUEST["product$pid"];
/*
echo "<script>alert('".$prodQty."')</script>";
echo "<script>alert('".$totalStock."')</script>";
*/
//if($prodQty<=$totalStock){
//$imgID=$_SESSION['cart'][$i]['imgID'];
$q=intval($_REQUEST['product'.$pid]);
if($q>0 && $q<=999){
$_SESSION['cart'][$i]['qty']=$q;
}
//}else{
//echo "<script>alert('Out of stock')</script>";
//}
}
}
if(empty($_SESSION['user_id']))$getUrl="login.php";else $getUrl="proceedtopay.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic page needs
============================================ -->
<title><?php include('title.php')?></title>
<meta charset="utf-8">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="">
<meta name="robots" content="index, follow" />
<!-- Mobile specific metas
============================================ -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Favicon
============================================ -->
<link rel="shortcut icon" type="image/png" href="<?php echo $url?>image/icon/favicon.png"/>
<!-- Libs CSS
============================================ -->
<link rel="stylesheet" href="<?php echo $url?>css/bootstrap/css/bootstrap.min.css">
<link href="<?php echo $url?>css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/owl-carousel/owl.carousel.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/lib.css" rel="stylesheet">
<link href="<?php echo $url?>js/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/minicolors/miniColors.css" rel="stylesheet">
<!-- Theme CSS
============================================ -->
<link href="<?php echo $url?>css/themecss/so_searchpro.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so_megamenu.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-categories.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-listing-tabs.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-category-slider.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-newletter-popup.css" rel="stylesheet">
<link href="<?php echo $url?>css/footer/footer2.css" rel="stylesheet">
<link href="<?php echo $url?>css/header/header2.css" rel="stylesheet">
<link id="color_scheme" href="<?php echo $url?>css/home2.css" rel="stylesheet">
<link href="<?php echo $url?>css/responsive.css" rel="stylesheet">
<!-- Google web fonts
============================================ -->
<link href='https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700' rel='stylesheet' type='text/css'>
<style type="text/css">
body{font-family:'Poppins', sans-serif}
</style>
<script language="javascript">
function addtocart(pid){
document.form1.productid.value=pid;
document.form1.command.value='add';
document.form1.submit();
}
function del(pid){
if(confirm('Do you really mean to delete this item')){
document.form1.pid.value=pid;
document.form1.command.value='delete';
document.form1.submit();
}
}
function update_cart(){
document.form1.command.value='update';
document.form1.submit();
}
</script>
<script>
//check pin code availablity
function checkPin1(){
str = document.getElementById('pincode1').value;
if(str!=''){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
if(xmlhttp.responseText==1){
alert('Deliver available product will be deliver within 12 working hours');
window.location='<?php echo $getUrl?>';
document.getElementById("button-cart1").disabled = false;
document.getElementById("button-cart2").disabled = false;
//document.getElementById("txtHint").innerHTML='<b style="color:green">Deliver available product will be deliver within 3-5 working days.</b>';
}else{
alert('Not Available');
document.getElementById("button-cart1").disabled = true;
document.getElementById("button-cart2").disabled = true;
//document.getElementById("txtHint").innerHTML='<b style="color:red">Not Available</b>';
}
}
}
xmlhttp.open("GET","<?php echo $url?>checkpin.php?q="+str,true);
xmlhttp.send();
}
}
</script>
<script>
function ChkPIN(){
if(document.getElementById('pincode1').value==''){
alert('Please Enter Your PIN Code');
document.getElementById('pincode1').focus();
}
}
</script>
</head>
<body class="common-home res layout-2">
<div id="wrapper" class="wrapper-fluid banners-effect-7">
<!-- Header Container -->
<?php include "includes/topbar.php";?>
<!-- //Header Top -->
<!-- Header center -->
<?php include "includes/searchbar.php";?>
<!-- //Header center -->
<!-- Header Bottom -->
<?php include "includes/navbar.php";?>
</header>
<!-- //Header Container -->
<!-- Main Container -->
<div class="main-container container" style="margin-bottom: 45px;">
<ul class="breadcrumb">
<li><a href="<?php echo $url?>#"><i class="fa fa-home"></i></a></li>
<li><a href="<?php echo $url?>#">Shopping Cart</a></li>
</ul>
<div class="row">
<!--Middle Part Start-->
<div id="content" class="col-sm-12">
<h2 class="title">Shopping Cart</h2>
<div class="table-responsive form-group">
<form name="form1" method="post">
<input type="hidden" name="pid" />
<input type="hidden" name="command" />
<table class="table table-bordered">
<thead>
<tr>
<td class="text-center">Image</td>
<td class="text-left">Product Name</td>
<td class="text-left">Quantity</td>
<td class="text-left">Delete</td>
<td class="text-right">Price</td>
<td class="text-right">Total</td>
</tr>
</thead>
<tbody>
<?php
$total_amt=0; $tot_shipping_charge=0;$mahaBachat=0;$bachat=0;$totalOldprc=0;$totalNewprc=0;
for($i=0;$i<$max;$i++){
$pid=$_SESSION['cart'][$i]['productid'];
$q=$_SESSION['cart'][$i]['qty'];
$s=$_SESSION['cart'][$i]['psize'];
$c=$_SESSION['cart'][$i]['pcolor'];
$img=$_SESSION['cart'][$i]['img_name'];
//$imgID=$_SESSION['cart'][$i]['imgID'];
//$price=get_price($pid);
$sql_Q=mysqli_query($con,"select * from product where id='$pid'");
$rtt = mysqli_fetch_array($sql_Q);
$path=json_decode($rtt['img']);
$totalStock=$rtt['stock'];
$productSize = explode(",",$rtt['oldprice']);
$expPrice = explode(",",$rtt['price']);
for($y=0;$y<sizeof($productSize);$y++){
if($productSize[$y]==$s){
$price = $expPrice[$y];
break;
}
}
$total_amt=$total_amt+$price*$q;
$tot_shipping_charge=$rtt['D_shipping'];
?>
<tr>
<td class="text-center"><a href="<?php echo $url?>product.php?pid=<?php echo $pid?>">
<img width="70px" src="<?php echo $url?>image/product/<?php echo $path[0]; ?>" alt="<?php echo $rtt['name'] ?>" title="<?php echo $rtt['name'] ?>" class="img-thumbnail" /></a></td>
<td class="text-left"><a href="<?php echo $url?>product.php?pid=<?php echo $pid?>"><?php echo $rtt['name'] ?></a><br />
<br/>
<?php if(!empty($s))echo $s;?>
</td>
<td class="text-left" width="100px"><div class="input-group btn-block quantity">
<input type="number" name="product<?php echo $pid?>" value="<?php echo $q ?>" size="1" max="10" min="1" class="form-control" onChange="update_cart()" />
<span class="input-group-btn">
<!-- <button type="submit" data-toggle="tooltip" title="Update" class="btn btn-primary"><i class="fa fa-clone"></i></button>-->
</span></div></td>
<td width="80px"><span class="input-group-btn">
<!-- <button type="submit" data-toggle="tooltip" title="Update" class="btn btn-primary"><i class="fa fa-clone"></i></button>-->
<a href="javascript:del(<?php echo $pid?>)" title="cancel" class="icon" style=" margin-left:10%">
<button type="button" data-toggle="tooltip" title="Remove Product" class="btn btn-danger" onClick="" ><i class="fa fa-times-circle"></i></button>
</a> </span></td>
<td class="text-right">Rs.<?php echo number_format($price,2) ?></td>
<td class="text-right">Rs.<?php echo number_format($price*$q,2) ?></td>
</tr>
<?php }
//$mahaBachat=$totalOldprc-$totalNewprc;
$mahaBachat=0;
?>
</tbody>
</table>
</form>
</div>
<div class="row">
<!--<div class="col-sm-6 col-md-6">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div id="collapse-coupon" class="panel-collapse collapse in" aria-expanded="true">
<div class="panel-body">
<div class="form-group required">
<label class="control-label">Enter Pin Code Here</label>
<div style="display: flex;">
<input type="number" name="pincode" id="pincode1" class="form-control" placeholder="Enter Pin Code" style="width:50%">
<button type="button" class="btn btn-primary" onClick="checkPin1()">Check</button>
</div>
<span id="txtHint"></span>
</div>
</div>
</div>
</div>
</div>
</div>-->
<div class="col-sm-4 col-md-4 col-sm-offset-8">
<table class="table table-bordered">
<tbody>
<tr>
<td class="text-right"><strong>Sub-Total:</strong> </td>
<td class="text-right">Rs.<?php echo number_format($total_amt,2)?></td>
</tr>
<tr>
<?php if($mahaBachat!=0 && $mahaBachat>0){?>
<tr>
<td class="text-right"><strong>Bachat</strong> </td>
<td class="text-right">Rs.<?php echo round($mahaBachat,2)?></td>
</tr>
<?php }?>
<td class="text-right"><strong>Shipping Charge:</strong> </td>
<td class="text-right"><?php
/*
if($total_amt<349){
$tot_shipping_charge=20;
}else{
$tot_shipping_charge=0;
}
*/
$tot_shipping_charge = 0;
echo "Rs.".number_format($tot_shipping_charge,2); ?> </td>
</tr>
<tr>
<td class="text-right"><strong>Total:</strong> </td>
<td class="text-right">Rs.<?php $totalAmountIs = $total_amt+$tot_shipping_charge; echo number_format($totalAmountIs,2); ?></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="buttons">
<div class="pull-left"><a href="<?php echo $url?>" class="btn btn-primary">Continue Shopping</a></div>
<div class="pull-right">
<a href="<?php echo $getUrl?>" id="button-cart1" class="btn btn-primary">Checkout</a>
</div>
</div>
</div>
</div>
</div>
<!-- Footer Container -->
<!-- Footer Container -->
<?php include "includes/footer.php" ?>
<!-- Include Libs & Plugins
============================================ -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="<?php echo $url?>js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/owl-carousel/owl.carousel.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/slick-slider/slick.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/libs.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/unveil/jquery.unveil.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/countdown/jquery.countdown.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/dcjqaccordion/jquery.dcjqaccordion.2.8.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/moment.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/jquery-ui/jquery-ui.min.js"></script>
<!-- Theme files
============================================ -->
<script type="text/javascript" src="<?php echo $url?>js/themejs/homepage.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/so_megamenu.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/addtocart.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/application.js"></script>
</body>
</html>