-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
195 lines (188 loc) · 8.53 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
session_start();
include('admin/connection.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>cart</title>
<link rel="stylesheet" href="./css/style.css" />
<!-- Fontawesome Css Link -->
<link rel="stylesheet" href="fontawesome/css/all.min.css" />
</head>
<body class="feature-body userbody">
<div class="overall-overlay"></div>
<?php
include('loginheader.php');
?>
<section class="cart" id="cart">
<div class="cart-container">
<h1 class="cart-title">Cart</h1>
<?php if (!empty($_SESSION['cart'])): ?>
<table class="cart-table">
<thead>
<th class="cart-img">Image</th>
<th class="cart-camp">Campsite</th>
<th class="cart-cost">Guests</th>
<th class="cart-cost">Cost</th>
<th class="cart-cost">Total</th>
</thead>
<tbody>
<?php
$total = 0;
foreach($_SESSION['cart'] as $pdid => $qty):
$query = "SELECT * FROM packagedetail,packages,packagetypes WHERE packagedetail.PDetailID=$pdid AND packagedetail.PKID=packages.PKID AND packagedetail.PKTID=packagetypes.PKTID";
$result = mysqli_query($connection, $query);
$row = mysqli_fetch_assoc($result);
$total += $row['Price'] * $qty;
?>
<tr>
<td class="cart-img">
<img src="./photo/<?php echo $row['Image2'] ?>"/>
</td>
<td class="cart-camp">
<p class='cart-camp-name'><?php echo $row['PKName'] ?></p>
<p class='cart-camp-type'>Type : <?php echo $row['PKTName'] ?></p>
<button class="delete-btn">
<a href="remove.php?id=<?php echo $pdid ?>">Delete</a>
</button>
</td>
<td class="cart-guests">
<div class="cart-guest-box">
<a href="increaseqty.php?id=<?php echo $pdid ?>" class="guest-increase">
<i class="fa-solid fa-plus"></i>
</a>
<p class="no-of-guest"><?php echo $qty ?>
</p>
<a href="decreaseqty.php?id=<?php echo $pdid ?>" class="guest-decrease">
<i class="fa-solid fa-minus"></i>
</a>
</div>
</td>
<td class="cart-cost">
$<?php echo $row['Price'] ?>
</td>
<td class="cart-cost">
$<?php echo $row['Price'] * $qty ?>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td colspan="2">
<?php
if (!empty($_SESSION['user'])) {
$user_email = $_SESSION['user'];
$query = "SELECT * FROM users WHERE UEmail='$user_email'";
$go_query = mysqli_query($connection, $query);
while ($out = mysqli_fetch_array($go_query)) {
$user_id = $out['UserID'];
$user_fname = $out['FirstName'];
$user_lname = $out['SurName'];
$email = $out['UEmail'];
$phone = $out['UPhoneNo'];
$address = $out['UAddress'];
}
}
?>
<form class="booking-form" method="post" action="submitorder.php">
<input type="text" hidden name="username" id="username" value="<?php echo $user_fname . " " . $user_lname ?>" />
<input type="email" hidden name="email" id="email" value="<?php echo $email ?>" />
<input type="tel" hidden name="phone" id="phone" value="<?php echo $phone ?>" />
<input type="text" hidden name="userid" value="<?php echo $user_id ?>" />
<!-- <select name="payment_type" id="payment-methods" class="payment-methods">
<option value="" disabled selected class="payment-methods-selected">
Payment Method
</option>
<option value="">1234 2345 3456</option>
<option value="">1234 2345 3456</option>
<option value="">1234 2345 3456</option>
</select> -->
<input type="text" required name="paymentcard" placeholder="Credit Card Number" />
</td>
<td colspan="3" align="right">
<b>Total:</b> $<?php echo $total; ?>
</td>
</tr>
</tbody>
</table>
<div class="panel-footer">
<button class="cart-confirm-btn" class="btn btn-success">
Submit Order!
</button>
</form>
<a class="cart-confirm-btn" href="clear.php" class="btn btn-danger">
Clear Cart
</a>
<a class="cart-confirm-btn" href="all.php" class="btn btn-default">
Back
</a>
</div>
</div>
<?php else: ?>
<div class="cart-null-state">
<img src="./assets/empty-cart.svg" class="empty-cart-img" alt="">
<p class="empty-cart-text">No Packages in the Cart</p>
<a href="./all.php" class="empty-cart-link">Search for more package here</a>
</div>
<?php endif; ?>
</div>
</section>
<!--
FOOTER
-->
<footer>
<div class="footer-container">
<div class="you-are-here">
<h3 class="footer-logo">You are here</h3>
<i class="fa-solid fa-chevron-right arr-right"></i>
<a href="" class="footer-nav-item">Cart</a>
</div>
<div class="footer-info-container">
<p class="copy-right">
© 2023 Global Wild Swimming & Camping All rights reserved
</p>
<div class="footer-info-box">
<a href="" class="footer-icon-box">
<img src="./assets/icons/facebook.svg" class="footer-icon" alt="" />
Facebook
</a>
<a href="" class="footer-icon-box">
<img src="./assets/icons/twitter.svg" class="footer-icon" alt="" />
Twitter
</a>
<a href="" class="footer-icon-box">
<img src="./assets/icons/insta.svg" class="footer-icon" alt="" />
Instagram
</a>
<a href="" class="footer-icon-box">
<img src="./assets/icons/youtube.svg" class="footer-icon" alt="" />
Youtube
</a>
<a href="rssfeed.php" class="footer-icon-box">
<img
src="./assets/icons/rss-feed.svg"
class="footer-icon"
alt=""
/>
Rss Feed
</a>
<!-- <a href="" > -->
<div class="footer-icon-box translatebox" id="google_element"></div>
<!-- </a> -->
</div>
</div>
</div>
</footer>
<!-- google translate script -->
<script src="http://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate"></script>
<script>
function loadGoogleTranslate(){
new google.translate.TranslateElement("google_element");
}
</script>
<script src="./js/script.js"></script>
<script src="./fontawesome/js/all.min.js"></script>
</body>
</html>