-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.php
80 lines (58 loc) · 2.12 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
<?php
session_start();
include_once "php/header.php";
include_once "php/productCard.php";
?>
<div class= "cart_wrapper"></div>
<h1 class="cart_title">My Cart</h1>
<div class="cart_container">
<div class="left_panel">
<div class="cart_col">
<div class="table_cart">
<table>
<tr>
<th></th>
<th>Product</th>
<th>Price</th>
<th>Quantity</th>
<th>Subtotal</th>
</tr>
<?php
if (isset($_SESSION['items'])){
foreach($_SESSION['items'] as $key => $item){
$amount = $_SESSION['cart'][$key];
$subtotal = ((float)$item[1] )*$amount;
createCardRow($item[0], $item[1], $item[2], $amount, $subtotal, $key);
}
}else{
echo "<h1 class=\"cart_title\">Your Cart is Empty</h1>";
}
?>
</table>
</div>
</div>
</div>
<div class="right_panel">
<div class="cart_box">
<?php
if (isset($_SESSION['grandTotal'])){
createCardRowRight($_SESSION['grandTotal']);
}
else{
echo "";
}
// echo "subtotals".var_dump($_SESSION['subTotals']);
// echo "<br>";
// echo "<br>";
// echo "grandtotal".var_dump($_SESSION['grandTotal']);
// echo "<br>";
// echo "<br>";
// echo "items".var_dump($_SESSION['items']);
?>
</div>
</div>
</div>
</div>
<?php
include_once 'php/footer.php';
?>