-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbag.php
More file actions
94 lines (74 loc) · 2.7 KB
/
bag.php
File metadata and controls
94 lines (74 loc) · 2.7 KB
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
<html lang="en">
<head>
<!-- Your head content -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Prockics | Bag</title>
<link rel="stylesheet" href="assets/css/bag.css" />
<!-- Font Awesome CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<?php
session_start();
?>
</head>
<body >
<div class="card">
<div class="card-row">
<div class="cart">
<?php
$subtotal = 0;
$ptotal = 0; // Initialize $ptotal here
if (isset($_SESSION['cart'])) {
echo "
<div class='title'>
<div class='title-row'>
<div class='your-bag'><h4><b>Your Bag</b></h4></div>
</div>
</div>";
foreach ($_SESSION['cart'] as $key => $value) {
// Check if 'productImage' and 'productQuantity' keys exist
$productImage = isset($value['productImage']) ? $value['productImage'] : '';
$productName = isset($value['productName']) ? $value['productName'] : '';
$productQuantity = isset($value['productQuantity']) ? $value['productQuantity'] : 1;
$productPrice = isset($value['productPrice']) ? $value['productPrice'] : 0;
$productPrice2 = isset($value['productPrice2']) ? $value['productPrice2'] : 0;
$ptotal += intval($productQuantity); // Update $ptotal
$productTotal = intval($productPrice) * intval($productQuantity); // Calculate product total
$subtotal += $productTotal; // Update $subtotal
echo "
<div class='main-product-container'>
<div class='product-container'>
<div class='img-container'>
<img class='img' src='./admin/product/{$productImage}'>
</div>
<div class='product-name'>
</div>
<div class='keys'>
<div class='pname'>{$productName}</div>
</div>
<div class='price-container'>
<div class='row upprice' data-price='{$productPrice}'>
<span class='row total-price' data-key='{$key}'> ₦ {$productTotal}</span>
</div>
<div class='big-price'> ₦ {$productPrice2}</div>
</div>
</div>
</div>";
}
}
?>
<div class="back-to-shop">
<a href="./index.php">
← <span class="text-muted">Back to Home</span>
</a>
</div>
<a href="checkout.php">
<button class="checkout-btn">CHECKOUT</button>
</a>
</div>
</div>
</div>
</div>
</body>
</html>