Preview: ecommerce-cart.php
Size: 12.07 KB
/home/urbanman/roadkaraja.in/manager/ecommerce-cart.php
<?php
error_reporting(0);
@session_start();
include("common.php");
include("config.php");
$id = $_POST['proid'];
$count = $_POST['count'];
//echo $count; exit;
if($id!='')
{
$isexist = array_search($id,$_SESSION['product_ids']);
if(strlen($isexist)<1)
{
$_SESSION['product_ids'][] = $id; //use self id
$_SESSION['product_count'][] = $count;
//$_SESSION['product_ids'][] = $proid;
}
else{
$_SESSION['product_count'][$isexist] = $count;
}
header("Location:ecommerce-cart.php");
}
$flag=$_GET['flag'];
if($flag=='remove')
{
$rem_id = $_GET['rem_id']; //use self id
$_SESSION['product_ids'][$rem_id]='';
}
$size = $_POST['size'];
//echo $size;
//$ccid = $_SESSION['cusid'];
$vnumber = $_POST['vnumber'];
$ccid = $_POST['cid'];
$cname = $_POST['cname'];
$que="select * from customer_product_point where cid='$ccid'";
if (!($p = mysql_query($que))) { echo "FOR QUERY: $strsql<BR>".mysql_error(); exit;}
$rowCount = mysql_num_rows($p);
$row=mysql_fetch_assoc($p);
$xml_config = simplexml_load_file($config_file);
$currency_symbol=$xml_config->configuration->currency_symbol;
$currency_code=$xml_config->configuration->currency_code;
$xml = simplexml_load_file($file);
$script_products="";
$script_product_prices="";
$script_products.="products[".($r->id)."]=\"".($r->name)."\";\n";
$script_product_prices.="point[".($r->id)."]=\"".($r->price)."\";\n";
?>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<!-- START: Main Content-->
<main>
<div class="container-fluid">
<!-- START: Breadcrumbs-->
<div class="row">
<div class="col-12 align-self-center">
<div class="sub-header mt-3 py-3 px-3 align-self-center d-sm-flex w-100 rounded">
<div class="w-sm-100 mr-auto"><h4 class="mb-0">MyCart</h4></div>
</div>
</div>
</div>
<!-- END: Breadcrumbs-->
<!-- START: Card Data-->
<div class="row">
<div class="col-12 mt-3">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-lg-12 col-xl-7 mb-4 mb-xl-0">
<table class="table table-bordered mb-0 table-responsive d-block border-bottom-0 border-top-0 border-left-0 border-right-0">
<thead>
<tr class="bg-transparent">
<th class="border-bottom-0">Image</th>
<th class="border-bottom-0">Product</th>
<th class="border-bottom-0">Point</th>
<th class="border-bottom-0">Quantity</th>
<th class="border-bottom-0">Total</th>
<th class="border-bottom-0"></th>
</tr>
</thead>
<tbody>
<?php
$count = count($_SESSION['product_ids']);
$i=0;
while($i<$count)
{
if($_SESSION['product_ids'][$i]!='')
{
$que = sprintf("Select * from product WHERE id = '%d' ",$_SESSION['product_ids'][$i]);
if(!($res=mysql_query($que))){echo "Error : - ".$que.mysql_error(); exit;}
$rowcart = mysql_fetch_assoc($res);
?>
<tr>
<td><img src="<?php echo "../admin/".$uploadpath.$rowcart['pimg']; ?>" class="img-fluid" width="60px" ></td>
<td class="align-middle"><?php echo $rowcart[proname];?> </td>
<td class="align-middle"><?php echo $rowcart[point];?> </td>
<td class="w-25 align-middle"><input class="cart_quantity_input" onKeyUp="multiply('quantity<?php echo $i; ?>','<?php echo $rowcart['sellprice']; ?>','three<?php echo $i; ?>')" type="text" name="quantity" id="quantity<?php echo $i; ?>" value="<?php echo $_SESSION['product_count'][$i]; ?>" size="3" style="border:0px solid #999" readonly></td>
<td class="align-middle"><input type="hidden" id="three<?php echo $i; ?>" name="three" readonly size="10" value="<?php echo $totalprice = $_SESSION['product_count'][$i]*$rowcart['point'];?>">
<?php echo $totalprice;?></td>
<td class="align-middle"><a href="ecommerce-cart.php?flag=remove&rem_id=<?php echo $i; ?>"><i class="icon-trash"></i></a></td>
</tr>
<?php
$total = $rowcart[point];
$item_total;
$item_total = $totalprice+$item_total;
?>
<?php } $i++; } ?>
</tbody>
</table>
<?php
$ccid = $_POST['cid'];
$ccnewid = $_SESSION['customerid'];
$que="select * from customer_product_point where cid='$ccnewid'";
if (!($p = mysql_query($que))) { echo "FOR QUERY: $strsql<BR>".mysql_error(); exit;}
$row=mysql_fetch_assoc($p);
$_SESSION['cusid'] = $row[cid];
$_SESSION['vehiclenumber'] = $row[vnumber];
$_SESSION['branch'] = $row[branch];
?>
</div>
<div class="col-lg-12 col-xl-5">
<div class=" border mb-3">
<div class="card-body border border-top-0 border-right-0 border-left-0">
<h4 class="f-weight-500 mb-0">Cart Total</h4>
</div>
<form method="post" action="success.php">
<div class="card-body">
<div class="clearfix">
<div class="float-left">
<p class="mb-0 dark-color f-weight-600"> Total Points:</p>
</div>
<div class="float-right">
<p class="mb-0 dark-color f-weight-600 h4"> <b><font color="blue"><?php echo $item_total;?></font></b></p>
</div>
</div>
</div>
<div class="card-body">
<div class="clearfix">
<div class="float-left">
<p class="mb-0 dark-color f-weight-600">Credit Points:</p>
</div>
<div class="float-right">
<p class="mb-0 dark-color f-weight-600 h4"><b><font color="blue"><?php echo $row[point];?></font></b></p>
</div>
</div>
</div>
</div>
<div class="clearfix d-sm-flex">
<?php if($row[point] >= $item_total || $row[point] == $item_total){?>
<div class="float-left w-100 text-center text-sm-left mb-3">
<?php
$_SESSION['item_total_point']=$item_total;
$count = count($_SESSION['product_ids']);
$_SESSION['cusid'] = $row[cid];
$_SESSION['vehiclenumber'] = $row[vnumber];
$_SESSION['branch'] = $row[branch];
?>
<button type="submit" class="btn btn-primary">Submit Process</button>
</div>
<?php } else {?>
<div class="float-left w-100 text-center text-sm-left mb-3">
<a href="" data-toggle="modal" data-target="#exampleModalCenter" class="btn btn-primary">Submit Process</a>
</div>
<?php }?>
<div class="float-right w-100 text-center text-sm-right">
<p class="mb-0 h6"><a href="customer-gift-list.php" class="btn btn-success" ><i class="icon-handbag h6"></i> Add to more Gift</a></p>
</div>
</div>
</form>
<!-- Button trigger modal -->
<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Sorry!</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Your total cart point is <b><?php echo $item_total;?></b> & your available wallet point is <b><?php echo $row[point];?></b>.<br>
So, please remove any item Or maintenance sufficient points. <br><br>
Thank You!
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END: Card DATA-->
</div>
</main>
<!-- END: Content-->
<!-- START: Footer-->
<!-- END: Footer-->
<!-- START: Back to top-->
<a href="#" class="scrollup text-center">
<i class="icon-arrow-up"></i>
</a>
<!-- END: Back to top-->
<!-- START: Template JS-->
<script src="dist/vendors/jquery/jquery-3.3.1.min.js"></script>
<script src="dist/vendors/jquery-ui/jquery-ui.min.js"></script>
<script src="dist/vendors/moment/moment.js"></script>
<script src="dist/vendors/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="dist/vendors/slimscroll/jquery.slimscroll.min.js"></script>
<!-- END: Template JS-->
<!-- START: APP JS-->
<script src="dist/js/app.js"></script>
<!-- START: Page JS-->
<script src="dist/js/home.script.js"></script>
<!-- END: Page JS-->
<style>
.btn4{
padding:4px;
background-color:#e91e63;
color:#fff;
border-radius:20px;
padding-left:20px;padding-right:20px;
border:2px solid #e91e63;
box-shadow:0 4px 10px 0 rgba(0,0,0,0.3);
width:150px;
}
.btn8{
padding:2px;
background-color:#f44336;
color:#fff;
border-radius:20px;
padding-left:20px;padding-right:20px;
border:2px solid #f44336;
box-shadow:0 4px 10px 0 rgba(0,0,0,0.3);
width:200px;
}
</style>
</body>
</html>
Directory Contents
Dirs: 5 × Files: 59