-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproduct.php
386 lines (312 loc) · 12.5 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?php
if (!isset($_SESSION)) {
session_start();
}
include("partials/connect.php");
//Kui kasutaja on sisse logitud, määra sessioonimuutuja
if (isset($_SESSION['email'])) {
$userLoggedIn = $_SESSION['email']; //Email of user
//Get user details from db
$user_details_query = mysqli_query($connect, "SELECT * FROM customers WHERE username='$userLoggedIn'");
$admin_query = mysqli_query($connect, "SELECT * FROM admins WHERE username='$userLoggedIn'");
//Kontrolli kas sisselogitud kasutaja on admin
if (mysqli_num_rows($admin_query) == 0) {
$user = mysqli_fetch_array($user_details_query); //return array from db (info about the logged in user)
} else {
$user = mysqli_fetch_array($admin_query); //return array from db (info about the logged in user)
}
}
// print_r($user);
/* print_r($_SESSION);
print_r($user_details_query);
print_r($admin_query); */
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Pood</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="images/icons/favicon.png" />
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/iconic/css/material-design-iconic-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/linearicons-v1.0.0/icon-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/animsition/css/animsition.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/daterangepicker/daterangepicker.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/slick/slick.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/MagnificPopup/magnific-popup.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/perfect-scrollbar/perfect-scrollbar.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!--===============================================================================================-->
</head>
<body class="animsition">
<header class="header-v4">
<?php
// Peamenüü
include("partials/header.php");
?>
</header>
<!-- Ostukorvi modaal -->
<?php include("partials/cartmodal.php");
// include("partials/connect.php");
// Toodete päring
$sql = "SELECT P.id AS prod_id, P.name AS prod_name, P.price AS price, P.picture AS picture, P.description AS description, P.category_id AS cat_id, C.name AS cat_name FROM Products P, Categories C WHERE P.category_id=C.id ORDER BY P.id DESC";
$sql2 = "SELECT * FROM Categories";
$cats = mysqli_query($connect, $sql2);
$results = $connect->query($sql); ?>
<!-- Tooted -->
<div class="bg0 p-b-140">
<div class="container">
<div class="flex-w flex-sb-m p-b-52">
<div class="flex-w flex-l-m filter-tope-group m-b-10">
<button class="stext-106 cl6 hov1 bor3 trans-04 m-r-32 m-tb-5 how-active1" data-filter="*">
Kõik tooted
</button>
<?php
while ($row = mysqli_fetch_array($cats)) { ?>
<button class="stext-106 cl6 hov1 bor3 trans-04 m-r-32 m-tb-5" data-filter=".<?php echo $row['id']; ?>">
<?php echo $row['name']; ?>
</button>
<?php }
?>
</div>
<!-- <div class="flex-w flex-c-m m-tb-10">
<div class="flex-c-m stext-106 cl6 size-104 bor4 pointer hov-btn3 trans-04 m-r-8 m-tb-4 js-show-filter">
<i class="icon-filter cl2 m-r-6 fs-15 trans-04 zmdi zmdi-filter-list"></i>
<i class="icon-close-filter cl2 m-r-6 fs-15 trans-04 zmdi zmdi-close dis-none"></i>
Filter
</div>
<div class="flex-c-m stext-106 cl6 size-105 bor4 pointer hov-btn3 trans-04 m-tb-4 js-show-search">
<i class="icon-search cl2 m-r-6 fs-15 trans-04 zmdi zmdi-search"></i>
<i class="icon-close-search cl2 m-r-6 fs-15 trans-04 zmdi zmdi-close dis-none"></i>
Otsing
</div>
</div> -->
<!-- Otsi toodet -->
<!-- <div class="dis-none panel-search w-full p-t-10 p-b-15">
<div class="bor8 dis-flex p-l-15">
<button class="size-113 flex-c-m fs-16 cl2 hov-cl1 trans-04">
<i class="zmdi zmdi-search"></i>
</button>
<input class="mtext-107 cl2 size-114 plh2 p-r-15" type="text" name="search-product" placeholder="Search">
</div>
</div> -->
<!-- Filter -->
<!-- <div class="dis-none panel-filter w-full p-t-10">
<div class="wrap-filter flex-w bg6 w-full p-lr-40 p-t-27 p-lr-15-sm">
<div class="filter-col1 p-r-15 p-b-27">
<div class="mtext-102 cl2 p-b-15">
Sort By
</div>
<ul>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
Default
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
Popularity
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
Average rating
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04 filter-link-active">
Newness
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
Price: Low to High
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
Price: High to Low
</a>
</li>
</ul>
</div>
<div class="filter-col2 p-r-15 p-b-27">
<div class="mtext-102 cl2 p-b-15">
Price
</div>
<ul>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04 filter-link-active">
All
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
$0.00 - $50.00
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
$50.00 - $100.00
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
$100.00 - $150.00
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
$150.00 - $200.00
</a>
</li>
<li class="p-b-6">
<a href="#" class="filter-link stext-106 trans-04">
$200.00+
</a>
</li>
</ul>
</div>
<div class="filter-col3 p-r-15 p-b-27">
<div class="mtext-102 cl2 p-b-15">
Color
</div>
<ul>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #222;">
<i class="zmdi zmdi-circle"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04">
Black
</a>
</li>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #4272d7;">
<i class="zmdi zmdi-circle"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04 filter-link-active">
Blue
</a>
</li>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #b3b3b3;">
<i class="zmdi zmdi-circle"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04">
Grey
</a>
</li>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #00ad5f;">
<i class="zmdi zmdi-circle"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04">
Green
</a>
</li>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #fa4251;">
<i class="zmdi zmdi-circle"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04">
Red
</a>
</li>
<li class="p-b-6">
<span class="fs-15 lh-12 m-r-6" style="color: #aaa;">
<i class="zmdi zmdi-circle-o"></i>
</span>
<a href="#" class="filter-link stext-106 trans-04">
White
</a>
</li>
</ul>
</div>
<div class="filter-col4 p-b-27">
<div class="mtext-102 cl2 p-b-15">
Tags
</div>
<div class="flex-w p-t-4 m-r--5">
<a href="#" class="flex-c-m stext-107 cl6 size-301 bor7 p-lr-15 hov-tag1 trans-04 m-r-5 m-b-5">
Fashion
</a>
<a href="#" class="flex-c-m stext-107 cl6 size-301 bor7 p-lr-15 hov-tag1 trans-04 m-r-5 m-b-5">
Lifestyle
</a>
<a href="#" class="flex-c-m stext-107 cl6 size-301 bor7 p-lr-15 hov-tag1 trans-04 m-r-5 m-b-5">
Denim
</a>
<a href="#" class="flex-c-m stext-107 cl6 size-301 bor7 p-lr-15 hov-tag1 trans-04 m-r-5 m-b-5">
Streetstyle
</a>
<a href="#" class="flex-c-m stext-107 cl6 size-301 bor7 p-lr-15 hov-tag1 trans-04 m-r-5 m-b-5">
Crafts
</a>
</div>
</div>
</div>
</div> -->
</div>
<div class="row isotope-grid">
<?php
while ($final = mysqli_fetch_array($results)) { ?>
<div class="col-sm-6 col-md-4 col-lg-3 p-b-35 isotope-item <?php echo $final['cat_id'] ?>">
<!-- Block2 -->
<div class="block2">
<div class="block2-pic hov-img0">
<img src="<?php echo $final['picture']; ?>" alt="IMG-PRODUCT" style="height:300px;">
<a href="details.php?details_id=<?php echo $final['prod_id']; ?>" class="block2-btn flex-c-m stext-103 cl2 size-102 bg0 bor2 hov-btn1 p-lr-15 trans-04">
<!-- js-show-modal1 -->
Vaata
</a>
</div>
<div class="block2-txt flex-w flex-t p-t-14">
<div class="block2-txt-child1 flex-col-l ">
<a href="details.php?details_id=<?php echo $final['prod_id']; ?>" class="stext-104 cl4 hov-cl1 trans-04 js-name-b2 p-b-6">
<?php echo $final['prod_name']; ?>
</a>
<span class="stext-105 cl3">
<?php echo $final['price']; ?>€
</span>
</div>
<div class="block2-txt-child2 flex-r p-t-3 ">
<a href="carthandler.php?cart_id=<?php echo $final['prod_id']; ?>&cart_name=<?php echo $final['prod_name']; ?>&cart_price=<?php echo $final['price']; ?>&cart_picture=<?php echo $final['picture']; ?>&cart_quantity=1" class="btn-addwish-b2 dis-block pos-relative js-addcart-detail">
<!-- <img class="icon-heart1 dis-block trans-04" src="images/icons/icon-heart-01.png" alt="ICON">
<img class="icon-heart2 dis-block trans-04 ab-t-l" src="images/icons/icon-heart-02.png" alt="ICON"> -->
<i class="fa fa-cart-plus" aria-hidden="true" data-tooltip="Lisa korvi" title="Lisa korvi"></i>
</a>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<!-- Footer -->
<?php
//Footer template
include("partials/footer.php");
?>
</body>
</html>