This repository has been archived by the owner on Jul 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
product.php
239 lines (231 loc) · 7.96 KB
/
product.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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
<!doctype html>
<html class="no-js" lang="en">
<?php
include_once 'elements\head.php';
include_once 'config\conn.php';
if (isset($_GET['product'])) {
$id = $_GET['product'];
// prepare and bind
$stmt = $conn->prepare("SELECT * FROM product WHERE id = ?");
$stmt->bind_param("i", $id);
// execute query
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
}
$row3 = $row;
?>
<body>
<!-- WRAPPER START -->
<div class="wrapper bg-dark-white">
<?php include_once 'elements\header.php' ?>
<!-- HEADING-BANNER START -->
<div class="heading-banner-area overlay-bg">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="heading-banner">
<div class="heading-banner-title">
<h2>Single Product</h2>
</div>
<div class="breadcumbs pb-15">
<ul>
<li><a href="index.php">Home</a></li>
<li>Single Product</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- HEADING-BANNER END -->
<!-- PRODUCT-AREA START -->
<div class="product-area single-pro-area pt-80 pb-80 product-style-2">
<div class="container">
<div class="row shop-list single-pro-info no-sidebar">
<!-- Single-product start -->
<div class="col-lg-12">
<div class="single-product clearfix">
<!-- Single-pro-slider Big-photo start -->
<div class="single-pro-slider single-big-photo view-lightbox slider-for">
<div>
<img src="admin/<?php echo $row3['thumbnail'] ?>" alt="" />
<a class="view-full-screen" href="admin/<?php echo $row3['thumbnail'] ?>"
data-lightbox="roadtrip" data-title="My caption"><i
class="zmdi zmdi-zoom-in"></i>
</a>
</div>
<?php
// lấy ảnh từ database product_image theo id của product
$stmt = $conn->prepare("SELECT * FROM product_image WHERE product_id = ?");
$stmt->bind_param("i", $id);
// execute query
$stmt->execute();
$result = $stmt->get_result();
// sử lý ảnh từ chuỗi dạng image01.png,image02.png,image03.png
$images = explode(',', $result->fetch_assoc()['image']);
foreach ($images as $image) {
echo '<div>
<img src="admin/uploads/medias/' . $image . '" alt="" />
<a class="view-full-screen" href="admin/uploads/medias/' . $image . '" data-lightbox="roadtrip" data-title="My caption">
<i class="zmdi zmdi-zoom-in"></i>
</a>
</div>';
}
?>
</div>
<!-- Single-pro-slider Big-photo end -->
<div class="product-info">
<div class="fix">
<h4 class="post-title floatleft">
<?php echo $row3["name"] ?>
</h4>
<span class="pro-rating floatright">
</span>
</div>
<div class="fix mb-20">
<span class="pro-price">$
<?php echo $row3['price_out'] ?>
</span>
</div>
<div class="product-description">
<p>
<?php echo $row3['description'] ?>
</p>
</div>
<!-- color start -->
<div class="color-filter single-pro-color mb-20 clearfix">
<ul>
<li><span class="color-title text-capitalize">Brand</span></li>
<li><span class=" text-capitalize"><b>
<?php
// lấy ra brand name từ bảng brand theo id của brand
$stmt = $conn->prepare("SELECT * FROM brand WHERE id = ?");
$stmt->bind_param("i", $row3['brand_id']);
// execute query
$stmt->execute();
$result = $stmt->get_result();
echo $result->fetch_assoc()['name'];
?>
</b></span></li>
</ul>
</div>
<!-- color end -->
<!-- Size start -->
<div class="size-filter single-pro-size mb-35 clearfix">
<ul>
</ul>
</div>
<!-- Size end -->
<div class="clearfix">
<form method="post" action="">
<div class="cart-plus-minus">
<input type="text" value="02" name="product_quantity"
class="cart-plus-minus-box">
</div>
<div class="product-action clearfix">
<a href="wishlist.html" data-bs-toggle="tooltip" data-placement="top"
title="Wishlist"><i class="zmdi zmdi-favorite-outline"></i></a>
<a href="#" data-bs-toggle="modal" data-bs-target="#productModal"
title="Quick View"><i class="zmdi zmdi-zoom-in"></i></a>
<a href="#" data-bs-toggle="tooltip" data-placement="top" title="Compare"><i
class="zmdi zmdi-refresh"></i></a>
<input type="hidden" name="product_id" value="<?php echo $row3['id'] ?>">
<input type="hidden" name="product_name"
value="<?php echo $row3['name'] ?>">
<input type="hidden" name="product_price"
value="<?php echo $row3['price_out'] ?>">
<button type="submit" class="btn" name="add-to-cart"><i
class="zmdi zmdi-shopping-cart-plus"></i></button>
</div>
</form>
</div>
<!-- Single-pro-slider Small-photo start -->
<div class="single-pro-slider single-sml-photo slider-nav">
<div>
<img src="admin/<?php echo $row3['thumbnail'] ?>" alt="" />
</div>
<?php
$stmt = $conn->prepare("SELECT * FROM product_image WHERE product_id = ?");
$stmt->bind_param("i", $id);
// execute query
$stmt->execute();
$result = $stmt->get_result();
// sử lý ảnh từ chuỗi dạng image01.png,image02.png,image03.png
$images = explode(',', $result->fetch_assoc()['image']);
foreach ($images as $image) {
echo '<div>
<img src="admin/uploads/medias/' . $image . '" alt="" />
</div>';
}
?>
</div>
<!-- Single-pro-slider Small-photo end -->
</div>
</div>
</div>
<!-- Single-product end -->
</div>
<!-- single-product-tab start -->
<div class="single-pro-tab">
<div class="row">
<div class="col-md-3">
<div class="single-pro-tab-menu">
<!-- Nav tabs -->
<ul class="nav d-block">
<li><a href="#description" data-bs-toggle="tab">Description</a></li>
<li><a class="active" href="#reviews" data-bs-toggle="tab">Reviews</a></li>
<li><a href="#information" data-bs-toggle="tab">Information</a></li>
<li><a href="#tags" data-bs-toggle="tab">Tags</a></li>
</ul>
</div>
</div>
<div class="col-md-9">
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane" id="description">
<div class="pro-tab-info pro-description">
<h3 class="tab-title title-border mb-30">
<?php echo $row3['name'] ?>
</h3>
<p>
<?php echo $row3['description'] ?>
</p>
</div>
</div>
<div class="tab-pane active" id="reviews">
<iframe class="pro-tab-info pro-description" height="800px" width="100%" src="comment.php?product_id=<?= $_GET['product']; ?>"></iframe>
</div>
<div class="tab-pane" id="information">
<div class="pro-tab-info pro-information">
<h3 class="tab-title title-border mb-30">Product information</h3>
<p>
<?php echo $row3['description'] ?>
</p>
</div>
</div>
<div class="tab-pane" id="tags">
<div class="pro-tab-info pro-information">
<h3 class="tab-title title-border mb-30">tags</h3>
<p></p>
<p></p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- single-product-tab end -->
</div>
</div>
<!-- PRODUCT-AREA END -->
<!-- FOOTER START -->
<?php include_once 'elements\footer.php' ?>
<!-- FOOTER END -->
</div>
<!-- WRAPPER END -->
<!-- all js here -->
<?php include_once 'elements\js.php' ?>
</body>
</html>