-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.php
452 lines (376 loc) · 17.4 KB
/
category.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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
<!doctype html>
<html lang="en">
<?php
session_start();
require 'phpfiles/init.php';
include_once 'phpfiles/Pagination.php';
//redirection
$full_path = pathinfo($_SERVER['PHP_SELF']);
$current_filename = $full_path['basename'];
$url = $_SERVER['REQUEST_URI'];
$id = substr($url, strrpos($url, '/') + 1);
$baseURL = 'http://localhost'.$full_path['dirname'].'/'.$id;
$_SESSION["redirectionflag"] = $id;
if(isset($_GET['search_query'])){
$search_query = $_GET['search_query'];
}else{
$search_query = '';
}
//echo $baseURL;
//return;
//$baseURL = 'http://localhost'.$full_path['dirname'].'/'.$current_filename.'';
$limit = 12;
// Paging limit & offset
$offset = !empty($_GET['page'])?(($_GET['page']-1)*$limit):0;
// Count of all records
if($search_query == ''){
$query = $conn->query("SELECT COUNT(*) as rowNum FROM product_details");
}else{
$query = $conn->query("SELECT COUNT(*) as rowNum FROM product_details WHERE name LIKE '%$search_query%';");
}
//$query = $conn->query("SELECT COUNT(*) as rowNum FROM product_details");
$result = $query->fetch_assoc();
$rowCount= $result['rowNum'];
// Initialize pagination class
$pagConfig = array(
'baseURL' => $baseURL,
'totalRows'=>$rowCount,
'perPage'=>$limit
);
$pagination = new Pagination($pagConfig);
// Fetch records based on the offset and limit
if($search_query == ''){
$query = $conn->query("SELECT * FROM product_details ORDER BY pid ASC LIMIT $offset,$limit");
}else{
$query = $conn->query("SELECT * FROM product_details WHERE name LIKE '%$search_query%';");
}
?>
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="icon" href="img/favicon.png" type="image/png">
<title>Fashiop</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="vendors/linericon/style.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="vendors/owl-carousel/owl.carousel.min.css">
<link rel="stylesheet" href="vendors/lightbox/simpleLightbox.css">
<link rel="stylesheet" href="vendors/nice-select/css/nice-select.css">
<link rel="stylesheet" href="vendors/animate-css/animate.css">
<link rel="stylesheet" href="vendors/jquery-ui/jquery-ui.css">
<!-- main css -->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/responsive.css">
</head>
<body>
<!--================Header Menu Area =================-->
<header class="header_area">
<div class="top_menu row m0">
<div class="container-fluid">
<div class="float-left">
<p>Call Us: 012 44 5698 7456 896
<?php
if(isset($_SESSION["email"])){
echo "   Welcome ".$_SESSION["name"]." !</p>";
}else{
echo "</p>";
}
?>
</div>
<div class="float-right">
<ul class="right_side">
<?php
if(isset($_SESSION["email"])){
echo "
<li>
<a href=\"#\" style=\"text-transform: initial;\">
".$_SESSION["email"]."
</a>
</li>";
}else{
echo "<li>
<a href=\"login.php\">
Login/Register
</a>
</li>";
}
?>
<li>
<a href="contact.php">
Contact Us
</a>
</li>
<?php if(isset($_SESSION["email"])){ ?>
<li>
<a href="phpfiles/logout.php">
Logout
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
<?php require 'header.php'; ?>
</header>
<!--================Header Menu Area =================-->
<!--================Category Product Area =================-->
<section class="cat_product_area section_gap">
<div class="container-fluid">
<!--Searching Product-->
<div class="row justify-content-center" style="margin-top:1%;margin-bottom:1%;">
<div class="col-lg-6">
<div id="mc_embed_signup">
<form novalidate action="category.php?search=" name="my_search" id="my_search" method="gxet" class="subscription relative">
<input type="text" name="search_query" id="search_query" placeholder="Enter product name..." onfocus="this.placeholder = ''" onblur="this.placeholder = 'Enter product name...'"
required="" >
<button type="submit" class="newsl-btn" onclick="document.getElementById('my_search').submit();">Search</button>
</form>
</div>
</div>
</div>
<!--Searching Product End-->
<div class="row flex-row-reverse">
<div class="col-lg-9">
<!--UPPER Product Filter options-->
<div class="product_top_bar">
<div class="right_page ml-auto">
<nav class="cat_page mx-auto" aria-label="Page navigation example">
<?php echo $pagination->createLinks(); ?>
</nav>
</div>
</div>
<!--UPPER Product Filter options END-->
<!-- Display products-->
<div class="latest_product_inner row">
<?php
/*
$sql = "SELECT pid,name,cost,img FROM product_details ORDER BY pid asc LIMIT ".$offset.",".$limit."";
$result = $conn->query($sql);
*/
if ($query->num_rows > 0) {
// output data of each row
$i=1;
while($row = $query->fetch_assoc()) {
?>
<div class="col-lg-3 col-md-3 col-sm-6">
<div class="f_p_item">
<div class="f_p_img">
<img class="img-fluid" src="img/product/set_01/<?php echo $row["img"]?>" alt="">
<!--<form action="single-product.php" method="get" id="my_form<?php echo $i ?>">
<input type="hidden" id="pid" name="pid" value="<?php echo $row["pid"] ?>">-->
<div class="p_icon" style="display:inline-flex;">
<form action="phpfiles/addtowishlist.php" method="get" id="my_form1<?php echo $i ?>">
<input type="hidden" id="pid" name="pid" value="<?php echo $row["pid"] ?>">
<a href="javascript:{}" onclick="document.getElementById('my_form1<?php echo $i ?>').submit();" >
<i class="lnr lnr-heart"></i>
</a >
</form>
<form action="single-product.php" method="get" id="my_form<?php echo $i ?>">
<input type="hidden" id="pid" name="pid" value="<?php echo $row["pid"] ?>">
<a href="javascript:{}" onclick="document.getElementById('my_form<?php echo $i ?>').submit();">
<i class="lnr lnr-cart"></i>
</a>
</form>
</div>
</div>
<a href="#">
<h4><?php echo $row["name"] ?></h4>
</a>
<h5>₹ <?php echo $row["cost"] ?>.00</h5>
</div>
</div>
<?php
$i++;
}
}else {
?>
<div class="col-lg-12 col-md-3 col-sm-6">
<center><h1>No results !</h1></center>
</div>
<?php
}
?>
</div>
<!-- Display products ENd-->
</div>
<!-- LEFT PRODUCT FILTER-->
<div class="col-lg-3">
<div class="left_sidebar_area">
<aside class="left_widgets p_filter_widgets">
<div class="l_w_title">
<h3>Product Filters</h3>
</div>
<div class="widgets_inner">
<h4>Company</h4>
<ul class="list">
<li id="i8">
<a href="#" onclick="document.getElementById('search_query').value='natural';
document.getElementById('my_search').submit();
">Natural</a>
</li>
<li id="i8">
<a href="#" onclick="document.getElementById('search_query').value='vaseline';
document.getElementById('my_search').submit();
">Vaseline</a>
</li>
<li id="i8">
<a href="#" onclick="document.getElementById('search_query').value='vega';
document.getElementById('my_search').submit();
">Vega</a>
</li>
<li id="i8">
<a href="#" onclick="document.getElementById('search_query').value='lakme';
document.getElementById('my_search').submit();
">Lakme</a>
</li>
</ul>
</div>
<div class="widgets_inner">
<h4>COLOUR</h4>
<ul class="list">
<li id="i2">
<a href="#" onclick="document.getElementById('search_query').value='blue';
document.getElementById('my_search').submit();
">Blue</a>
</li>
<li id="i3">
<a href="#" onclick="document.getElementById('search_query').value='green';
document.getElementById('my_search').submit();
">Green</a>
</li>
<li id="i4">
<a href="#" onclick="document.getElementById('search_query').value='black';
document.getElementById('my_search').submit();
">Black</a>
</li>
<li id="i5">
<a href="#" onclick="document.getElementById('search_query').value='red';
document.getElementById('my_search').submit();
">Red</a>
</li >
<li id="i6" class="">
<a href="#" onclick="document.getElementById('search_query').value='pink';
document.getElementById('my_search').submit();
">Pink</a>
</li>
<li id="i7">
<a href="#" onclick="document.getElementById('search_query').value='white';
document.getElementById('my_search').submit();
">White</a>
</li>
<li id="i8">
<a href="#" onclick="document.getElementById('search_query').value='yellow';
document.getElementById('my_search').submit();
">Yellow</a>
</li>
</ul>
</div>
</aside>
</div>
</div>
<!-- LEFT PRODUCT FILTER END-->
</div>
<div class="row" style="margin-top:5%;">
<nav class="cat_page mx-auto" aria-label="Page navigation example">
<?php echo $pagination->createLinks(); ?>
</nav>
</div>
</div>
</section>
<!--================End Category Product Area =================-->
<!--================ Subscription Area ================-->
<section class="subscription-area section_gap">
<div class="container">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="section-title text-center">
<h2>Subscribe for Our Newsletter</h2>
<span>We won’t send any kind of spam</span>
</div>
</div>
</div>
<div class="row justify-content-center">
<div class="col-lg-6">
<div id="mc_embed_signup">
<form target="_blank" novalidate action="https://spondonit.us12.list-manage.com/subscribe/post?u=1462626880ade1ac87bd9c93a&id=92a4423d01"
method="get" class="subscription relative">
<input type="email" name="EMAIL" placeholder="Email address" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Email address'"
required="">
<!-- <div style="position: absolute; left: -5000px;">
<input type="text" name="b_36c4fd991d266f23781ded980_aefe40901a" tabindex="-1" value="">
</div> -->
<button type="submit" class="newsl-btn">Get Started</button>
<div class="info"></div>
</form>
</div>
</div>
</div>
</div>
</section>
<!--================ End Subscription Area ================-->
<!--================ start footer Area =================-->
<?php require 'footer.php'; ?>
<!--================ End footer Area =================-->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/stellar.js"></script>
<script src="vendors/lightbox/simpleLightbox.min.js"></script>
<script src="vendors/nice-select/js/jquery.nice-select.min.js"></script>
<script src="vendors/isotope/imagesloaded.pkgd.min.js"></script>
<script src="vendors/isotope/isotope-min.js"></script>
<script src="vendors/owl-carousel/owl.carousel.min.js"></script>
<script src="js/jquery.ajaxchimp.min.js"></script>
<script src="js/mail-script.js"></script>
<script src="vendors/jquery-ui/jquery-ui.js"></script>
<script src="vendors/counter-up/jquery.waypoints.min.js"></script>
<script src="vendors/counter-up/jquery.counterup.js"></script>
<script src="js/theme.js"></script>
<script>
function isUserLoggedIn(){
var data = "<?php if(isset($_SESSION["id"]))echo true; else echo false; ?>";
//alert(data);
if(data==1){
//user is logged in, go ahead
location.href='cart.php';
//document.getElementById('my_form').submit();
}else{
//prompt user to login
alert("Please login to load your cart !");
location.href='login.php';
}
}
function isUserLoggedIn2(){
var data = "<?php if(isset($_SESSION["id"]))echo true; else echo false; ?>";
//alert(data);
if(data==1){
//user is logged in, go ahead
location.href='userdetails.php';
//document.getElementById('my_form').submit();
}else{
//prompt user to login
alert("Please login to load your cart !");
location.href='login.php';
}
}
function isUserLoggedInPast(){
var data = "<?php if(isset($_SESSION["id"]))echo true; else echo false; ?>";
//alert(data);
if(data==1){
//user is logged in, go ahead
location.href='pastorder.php';
//document.getElementById('my_form').submit();
}else{
//prompt user to login
alert("Please login to load your cart !");
location.href='login.php';
}
}
</script>
</body>
</html>