-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_shoppincart.php
68 lines (59 loc) · 1.75 KB
/
load_shoppincart.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
<?php
include('dbconfig.php');
session_start();
if (isset($_SESSION["login_user"])) {
$login_id = $_SESSION["login_id"];
$query = mysqli_query($conn,"SELECT * FROM `order` WHERE user_ID = $login_id AND ors_ID = 0");
if (mysqli_num_rows($query) > 0)
{
$rows = mysqli_fetch_assoc($query);
$or_ID = $rows["or_ID"];
$sql = "SELECT * FROM `order_item` `ordi`
LEFT JOIN `products` `prod` ON `ordi`.`prod_ID` = `prod`.`prod_ID`
where `ordi`.`or_ID` = $or_ID ";
$items = mysqli_query($conn,$sql);
?>
<ul class="list-group">
<li class="list-group-item active">Order #<?php echo $or_ID;?></li>
<li class="list-group-item ">
<table class="table table-striped table-sm" >
<thead>
<th>#</th>
<th>Item</th>
<th>Price</th>
<th>Quantity(KG)</th>
<th>Subtotal</th>
<th class="text-center">Action</th>
</thead>
<tbody>
</tbody>
<?php
$Total = 0 ;
while($row = mysqli_fetch_assoc($items))
{
$Subtotal = $row['ord_Weight'] * $row['ord_Price'];
?>
<tr>
<td><?php echo $row['ord_ID'];?></td>
<td><?php echo $row['prod_Name'];?></td>
<td><?php echo '₱ '.$row['ord_Price'];?></td>
<td><?php echo $row['ord_Weight'];?></td>
<td><?php echo '₱ '.number_format($Subtotal,2);?></td>
<td class="text-center remove_item" data-id="<?php echo $row['ord_ID'];?>">x</td>
</tr>
<?php
$Total += $Subtotal ;
}
?>
</table>
</li>
<li class="list-group-item"><div class=" float-right">Total: <?php echo '₱ '.number_format($Total,2);?></div></li>
<input type="hidden" name="or_ID" id="or_ID" value="<?php echo $or_ID;?>">
</ul>
<?php
}
else{
echo "NO ORDER CONTENT";
}
}
?>