forked from sajjadsaleem341/Plant-Nest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
160 lines (148 loc) · 6.09 KB
/
categories.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
<?php
include 'header.php';
$msg = 'Data Not Found';
$cat_id = mysqli_real_escape_string($con,$_GET['id']);
if($cat_id>0){
$get_product = get_product($con,'',$cat_id,'');
}
else{
echo "<script>window.location.href='index.php'</script>";
}
$sql = "select * from categories";
$res = mysqli_query($con,$sql);
$cat_arr=array();
while($row=mysqli_fetch_assoc($res)){
$cat_arr[]=$row;
}
?>
<!-- ##### Breadcrumb Area Start ##### -->
<div class="breadcrumb-area">
<!-- Top Breadcrumb Area -->
<div class="top-breadcrumb-area bg-img bg-overlay d-flex align-items-center justify-content-center"
style="background-image: url(img/bg-img/24.jpg);">
<h2>Shop</h2>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#"><i class="fa fa-home"></i> Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Shop</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<!-- ##### Breadcrumb Area End ##### -->
<!-- ##### Shop Area Start ##### -->
<section class="shop-page section-padding-0-100">
<div class="container">
<div class="row">
<!-- Shop Sorting Data -->
<div class="col-12">
<div class="shop-sorting-data d-flex flex-wrap align-items-center justify-content-between">
<!-- Shop Page Count -->
<div class="shop-page-count">
<p>Shop by Categories</p>
</div>
<!-- Search by Terms -->
<div class="search_by_terms">
<form action="#" method="post" class="form-inline">
<select class="custom-select widget-title">
<option selected>Sort By Newest</option>
<option value="1">Short by A-Z</option>
<option value="2">Short by Sales</option>
<option value="3">Short by Ratings</option>
</select>
</form>
</div>
</div>
</div>
</div>
<div class="row">
<!-- Sidebar Area -->
<div class="col-12 col-md-4 col-lg-3">
<div class="shop-sidebar-area">
<!-- Shop Widget -->
<div class="shop-widget catagory mb-50">
<h4 class="widget-title">Categories</h4>
<div class="widget-desc">
<!-- Single Checkbox -->
<div class="custom-control custom-checkbox d-flex align-items-center mb-2">
<a href="shop.php" style="color:#6c757d; font-size: 15px;" ><label class="" for="customCheck2">All Plants</label></a>
</div>
<?php
foreach($cat_arr as $list){
?>
<!-- Single Checkbox -->
<div class="custom-control custom-checkbox d-flex align-items-center mb-2">
<a href="categories.php?id=<?= $list['Id']?>" style="color:#6c757d; font-size: 15px;"><label class="" for="customCheck2"><?= $list['Categories']?></label></a>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<!-- All Products Area -->
<?php
if(count($get_product)>0){
?>
<div class="col-12 col-md-8 col-lg-9">
<div class="shop-products-area">
<div class="row">
<!-- Single Product Area -->
<?php
$get_product=get_product($con,'',$cat_id,'');
foreach($get_product as $list){
?>
<div class="col-12 col-sm-6 col-lg-4">
<div class="single-product-area mb-50">
<!-- Product Image -->
<div class="product-img">
<a href="product.php?id=<?= $list['Id']?>"><img src="./image/<?= $list['Image'] ?>"></a>
</div>
<!-- Product Info -->
<div class="product-info mt-15 text-center">
<a href="product.php?id=<?= $list['Id']?>">
<p><?= $list['Name']?></p>
</a>
<h6>$<?= $list['Price']?></h6>
</div>
</div>
</div>
<?php
}
?>
</div>
<!-- Pagination -->
<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#">1</a></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
<li class="page-item"><a class="page-link" href="#"><i class="fa fa-angle-right"></i></a>
</li>
</ul>
</nav>
</div>
</div>
<?php
}
else{
?>
<div class="col-12" style="text-align:center; font-size:25px;color:red;">
<?= $msg ?>
</div>
<?php
}
?>
</div>
</div>
</section>
<!-- ##### Shop Area End ##### -->
<?php
include 'footer.php';
?>