-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathview.php
175 lines (166 loc) · 6.92 KB
/
view.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
<?php
require('require/top.php');
$categories=get_all_categories($con);
$subcategories=get_all_sub_categories($con,$_GET['n']);
$all_product=array();
$key=$_GET['k'];
$cat=$_GET['n'];
if(isset($_GET['n']) && !isset($_GET['scat']) && !isset($_GET['filter']) && !isset($_GET['subfilter'])){
$all_product=search_product($con,$key,$cat);
}else if(isset($_GET['n']) && isset($_GET['scat']) && !isset($_GET['filter']) && !isset($_GET['subfilter'])){
$scat=$_GET['scat'];
$all_product=search_product($con,$key,$cat,$scat);
}else if(isset($_GET['n']) && isset($_GET['scat']) && isset($_GET['filter']) && !isset($_GET['subfilter'])){
$filter=$_GET['filter'];
$scat=$_GET['scat'];
$all_product=search_product($con,$key,$cat,$scat,$filter);
}else if(isset($_GET['n']) && isset($_GET['scat']) && isset($_GET['filter']) && isset($_GET['subfilter'])){
$filter=$_GET['filter'];
$scat=$_GET['scat'];
$sfilter=$_GET['subfilter'];
$all_product=search_product($con,$key,$cat,$scat,$filter,$sfilter);
}
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="">Search</a>
</div>
</div>
<section class="view-product">
<div class="row">
<section class="search">
<div class="searchrow">
<div class="left">
<div class="shop-by-depertment">
<h2>Shop by depertment</h2>
<ul>
<?php
foreach($categories as $cat){
?>
<li><a href="view.php?n=<?php echo $cat['id']; ?>&k="><?php echo $cat['category']; ?></a></li>
<?php } ?>
</ul>
</div>
<div class="shop-by-depertment" style="margin-top:2rem;">
<h2>price range</h2>
<ul>
<input type="range" name="price" id="price-input" min="1" max="1000" value="1000"
oninput="getprice()" style="accent-color:#f55d2c;border:none">
<div class="inrow" style="margin-top: 1.5rem;">
<div class="in">
<h4>₹0</h4>
</div>
<div class="in">
<h4>₹<span id="fnlp">1000</span></h4>
</div>
<div class="in">
<h4 class="underline" onclick="filterPrice()" style="cursor:pointer">filter</h4>
</div>
</div>
</ul>
</div>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>sub category</h2>
<ul>
<?php
foreach($subcategories as $cat){
if(isset($_GET['scat']) && $_GET['scat']==$cat['id']){
?>
<li>
<input type="checkbox" name="check" value="<?php echo $cat['id']; ?>" onchange="checksubcat(this)" checked> <label for="none"><?php echo $cat['subcat']; ?></label>
</li>
<?php
}else{
?>
<li>
<input type="checkbox" name="check" value="<?php echo $cat['id']; ?>" onchange="checksubcat(this)"> <label for="none"><?php echo $cat['subcat']; ?></label>
</li>
<?php
} } ?>
</ul>
</div>
<?php if(isset($_GET['scat'])){
$filters=array();
$filters=get_all_sub_categories_filters($con,$_GET['scat']);
?>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>filter</h2>
<ul>
<?php
foreach($filters as $filter){
if(isset($_GET['filter']) && $_GET['filter']==$filter['id']){
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checkfilter(this)" checked> <label for="none"><?php echo $filter['filter']; ?></label>
</li>
<?php
}else{
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checkfilter(this)"> <label for="none"><?php echo $filter['filter']; ?></label>
</li>
<?php
} } ?>
</ul>
</div>
<?php }
if(isset($_GET['filter'])){
$subfilters=array();
$subfilters=get_all_sub_filters($con,$_GET['filter']);
?>
<div class="shop-by-depertment" style="border-top: 0;">
<h2>sub filter</h2>
<ul>
<?php
foreach($subfilters as $filter){
if(isset($_GET['subfilter']) && $_GET['subfilter']==$filter['id']){
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checksfilter(this)" checked> <label for="none"><?php echo $filter['subfilter']; ?></label>
</li>
<?php
}else{
?>
<li>
<input type="checkbox" name="check" value="<?php echo $filter['id']; ?>" onchange="checksfilter(this)"> <label for="none"><?php echo $filter['subfilter']; ?></label>
</li>
<?php
} } ?>
</ul>
</div>
<?php } ?>
</div>
<div class="right">
<h1>Shop</h1>
<div class="outerbox">
<?php
if(count($all_product)!=0){
foreach($all_product as $product){
?>
<div class="product" style="background:#fff">
<div class="image">
<img src="media/product/<?php echo $product['img1'] ?>" alt="product" >
</div>
<div class="detail">
<h4>
<a href="product_detail.php?pid=<?php echo ($product['id']); ?>&type='detail'&show='2'"><?php echo $product['product_name'] ?></a>
</h4>
<p class="price">₹<span class="ftrp"><?php echo $product['fa'] ?></span></p>
</div>
</div>
<?php
}
} else{
echo "<h1>Nothing Found</h1>";
}
?>
</div>
</div>
</div>
</section>
</div>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?>