-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
95 lines (87 loc) · 2.57 KB
/
cart.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
include('Userc.php');
$object=new Userc;
if (isset($_SESSION['user'])) {
$return=$object->viewCart($_SESSION['user']);
//another function
$sumtotal=$object->addTotal($_SESSION['user']);
//another function
//$object->deleteAllFromCart($_SESSION['user']);
}
//print_r($sumtotal);
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, fit-to-shrink=no">
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/all.min.css">
</head>
<body>
<?php
include('header2.php');
?>
<div class="container">
<div class="row">
<div class="col">
<div class="card">
<h3>Products in your cart</h3>
<div class="card-body">
<?php
if (empty($sumtotal['SUM(total_price)'])) {
echo "<div class='alert alert-danger'>There are no items in your cart</div>";
}
?>
<div class="table-responsive">
<table class="table table-hover">
<tr>
<th>Image</th>
<th>Product Name</th>
<th>Quantity</th>
<th>Price</th>
<th>Total price</th>
<th>Remove</th>
</tr>
<?php
foreach ($return as $value) {
$p_id=$value['product_id'];
$image="pix_tailor/".$value['upload_pix'];
?>
<tr>
<td><img src="<?php echo $image; ?>" class="" height="30%"></td>
<td><?php echo $value['product_name']; ?></td>
<td><?php echo $value['order_quantity']; ?></td>
<td><?php echo $value['order_amt']; ?></td>
<td><?php echo $value['total_price']; ?></td>
<td><a href="deleteperitem.php?upload_id=<?php echo $p_id; ?>" onclick="return confirm('are you sure you want to delete this item?')">Remove <i class="fa fa-trash text-danger"></i></a></td>
</tr>
<?php
}
?>
<tr>
<td></td>
<td></td>
<td></td>
<th>Grand Total: <?php
if (!empty($sumtotal['SUM(total_price)'])) {
echo $sumtotal['SUM(total_price)'];
}
else{
echo "0";
}
?></th>
<td></td>
</tr>
</table>
</div>
<a href="deleteallcart.php" class="btn btn-warning" type="submit" onclick="return confirm('Are you sure you want to delete all items from cart?')">Clear Cart</a>
<a href="proceed.php?total=<?php echo $sumtotal['SUM(total_price)'];?>" class="btn btn-primary" name="submit" type="Submit">Check out</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>