-
Notifications
You must be signed in to change notification settings - Fork 0
/
productPage.php
217 lines (209 loc) · 7.81 KB
/
productPage.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
session_start();
if (isset($_GET['id'])){
$subjectId = $_GET['id'];
// Establish connection with DB
@ $db = new mysqli('localhost', 'f32ee', 'f32ee', 'f32ee');
if (mysqli_connect_errno()) {
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
// Fetch row of shoe data using id
$query = "SELECT * FROM shoes_table WHERE product_id = $subjectId";
$result = $db->query($query);
$row = $result->fetch_assoc();
// Check for cart items
if (!isset($_SESSION['cart'])) {
$_SESSION['cart'] = array();
}
if ($_POST['quantity']) {
$_SESSION['cart'][] = ['product_id'=>$subjectId, 'shoe_img'=>$row['img_diagonal'], 'name'=>$row['name'], 'color'=>$row['color'], 'size'=>$_POST['size'], 'price'=>$row['price'], 'quantity'=>$_POST['quantity']] ;
}
}else{
echo "provide Id";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>DAMES.</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div id="wrapper">
<header>
<a href="index.php" id="header1"><h1>DAMES.</h1></a>
</header>
<nav>
<b>
<div class="navbar-center">
<span class="nav-icon"> </span>
<span class="nav-list">
<a href="index.php">LATEST</a>
<a href="men.php">MEN</a>
<a href="women.php">WOMEN</a>
<a href="myOrders.php">MY ORDERS</a>
<a href="location.php">LOCATION</a>
</span>
<span class="nav-icon">
<a href="shoppingBag.php"
><img id="shoppingBag" src="assets/shoppingBag/shoppingBag.png"/>
<div class="cart_items"><?php echo count($_SESSION['cart']) ?></div>
</a>
</span>
</div>
</b>
</nav>
<main>
<h2>PRODUCT PAGE</h2>
<div class="productpage-row">
<div class="productpage-column-left">
<!-- Container for the image gallery -->
<div class="productPage-slidegallery-container">
<!-- Full-width images with number text -->
<div class="mySlides">
<div class="numbertext">1 / 5</div>
<img
src="assets/productPage/<?php echo $row['img_diagonal'] ?>"
style="width: 100%"
/>
</div>
<div class="mySlides">
<div class="numbertext">2 / 5</div>
<img
src="assets/productPage/<?php echo $row['img_side'] ?>"
style="width: 100%"
/>
</div>
<div class="mySlides">
<div class="numbertext">3 / 5</div>
<img
src="assets/productPage/<?php echo $row['img_back'] ?>"
style="width: 100%"
/>
</div>
<div class="mySlides">
<div class="numbertext">4 / 5</div>
<img
src="assets/productPage/<?php echo $row['img_frontside'] ?>"
style="width: 100%"
/>
</div>
<div class="mySlides">
<div class="numbertext">5 / 5</div>
<img
src="assets/productPage/<?php echo $row['img_top'] ?>"
style="width: 100%"
/>
</div>
<!-- Next and previous buttons -->
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
<!-- Thumbnail images -->
<div class="row">
<div class="column">
<img
class="demo cursor"
src="assets/productPage/<?php echo $row['img_diagonal'] ?>"
style="width: 100%"
onclick="currentSlide(1)"
/>
</div>
<div class="column">
<img
class="demo cursor"
src="assets/productPage/<?php echo $row['img_side'] ?>"
style="width: 100%"
onclick="currentSlide(2)"
/>
</div>
<div class="column">
<img
class="demo cursor"
src="assets/productPage/<?php echo $row['img_back'] ?>"
style="width: 100%"
onclick="currentSlide(3)"
/>
</div>
<div class="column">
<img
class="demo cursor"
src="assets/productPage/<?php echo $row['img_frontside'] ?>"
style="width: 100%"
onclick="currentSlide(4)"
/>
</div>
<div class="column">
<img
class="demo cursor"
src="assets/productPage/<?php echo $row['img_top'] ?>"
style="width: 100%"
onclick="currentSlide(5)"
/>
</div>
</div>
</div>
</div>
<div class="productpage-column-right">
<h4 class="product-title"><?php echo $row['name'] ?></h4>
<p class="product-description"><?php echo $row['description'] ?><br></p>
<span class="product-color"><?php echo $row['color'] ?></span><br /><br />
<span class="product-price">S$<?php echo $row['price'] ?></span><br /><br />
<span class="product-size">Size</span><br /><br />
<form action="productPage.php?id=<?php echo $subjectId ?>" method="POST">
<div class="buttongroup">
<?php
$sizes = explode(",", $row['size']);
for ($i=0; $i <count($sizes); $i++) {
echo "<input id='$sizes[$i]' type='radio' value='$sizes[$i]' name='size' checked/>
<label for='$sizes[$i]'>$sizes[$i]</label>";
}
?>
</div>
<br /><br />
<span class="product-size">Quantity</span><br />
<div class="quantity buttons_added">
<input type="number" id='qty_id' name="quantity" step="1" min="0" value="1" title="Qty" size="3" onchange="validateQty()">
</div>
<br /><br />
<input type="submit" id="addToCartBtn" value="Add to Cart">
</form>
</div>
</div>
</main>
</div>
</body>
<script type="text/javascript" src="productPageSlideGallery.js"></script>
<footer>
<div class="flex-row-container">
<div class="flex-row-item1">
<h3>About Us</h3>
<br />
Here at DAMES., we realize that style and prosperity begin with the
correct shoes. We likewise understand that effectively finding the size
and style to meet your requirements is vital to your web based shopping
knowledge. Since beginning our web based business website in 2009, we’ve
been endeavoring to present to you that perfect shopping experience.
</div>
<div class="flex-row-item2">
<h3>Customer Service</h3>
<br />
Tel: +65 6888 8888<br /><br />
Email: <a href="mailto:[email protected]">[email protected]</a
><br /><br />
<u><a href="myOrders.php">Track Your Order</a></u>
</div>
<div class="flex-row-item3">
<h3></h3>
<br />
<img
id="paymentImage"
src="assets/footer/Six accepted payment icons.png"
/><br />
Copyright © 2021 DAMES.
</div>
</div>
</footer>
<script type="text/javascript" src="validate.js"></script>
</html>