-
Notifications
You must be signed in to change notification settings - Fork 0
/
books.php
276 lines (254 loc) · 10 KB
/
books.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
<?php
session_start();
if( !isset($_SESSION['id']))
{
require "header.php"; //....Without login...//
}
else
{
require "header2.php"; //....User Logged in...//
}
?>
<!-- Start Slider area -->
<div class="slider-area brown__nav slider--15 slide__activation slide__arrow01 owl-carousel owl-theme">
<!-- Start Single Slide -->
<div class="slide animation__style10 bg-image--1 fullscreen align__center--left">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="slider__content">
<div class="contentbox">
<h2>Buy <span>your </span></h2>
<h2>favourite <span>Book </span></h2>
<h2>from <span>Here </span></h2>
<a class="shopbtn" href="#">shop now</a>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End Single Slide -->
</div>
<!-- End Slider area -->
<!-- Start Shop Page -->
<div class="page-shop-sidebar left--sidebar bg--white section-padding--lg">
<div class="container">
<div class="row">
<div class="col-lg-3 col-12 order-2 order-lg-1 md-mt-40 sm-mt-40">
<div class="shop__sidebar">
<aside class="wedget__categories poroduct--cat">
<h3 class="wedget__title">Product Categories</h3>
<ul>
<?php
require('db.php');
if(!$con)
{echo "DB not connected"; die;}
$sql="select * from categories where Parent_ID=0";
$result=mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
{
$sq="select * from products where cat_id=". $row['ID'];
$res=mysqli_query($con,$sq);
$total=mysqli_num_rows($res); //*****getting no. of products of category********//
?>
<li><a href="javascript:void(0);" onclick="subcat(<?php echo $row['ID']; ?>)">
<?php echo $row['Name']; ?>
<span> <?php echo '('.$total.')'; ?>
</span></a></li>
<?php } ?>
</ul>
</aside>
<aside class="wedget__categories pro--range">
<h3 class="wedget__title">Filter by price</h3>
<div class="content-shopby">
<div class="price_filter s-filter clear">
<form action="#" method="GET">
<div id="slider-range"></div>
<div class="slider__range--output">
<div class="price__output--wrap">
<div class="price--output">
<input type="hidden" id="hidden_min" value="10" />
<input type="hidden" id="hidden_max" value="500" />
<span>Price :</span><input type="text" id="amount" readonly="">
</div>
<div class="price--filter">
<a href="javascript:void(0);" onclick="price_filter()">Filter</a>
</div>
</div>
</div>
</form>
</div>
</div>
</aside>
</div>
</div>
<div class="col-lg-9 col-12 order-1 order-lg-2">
<div class="row">
<div class="col-lg-12">
<div class="shop__list__wrapper d-flex flex-wrap flex-md-nowrap justify-content-between">
<div class="shop__list nav justify-content-center" role="tablist">
<a class="nav-item nav-link active" data-toggle="tab" href="#nav-grid" role="tab"><i class="fa fa-th"></i></a>
<a class="nav-item nav-link" data-toggle="tab" href="#nav-list" role="tab"><i class="fa fa-list"></i></a>
</div>
<p>Showing <span id="count"></span> results</p>
<div class="orderby__wrapper">
<span>Sort By</span>
<select id="select" class="shot__byselect" onchange="sort()">
<option value="0">Default sorting</option>
<option value="1">Category</option>
<option value="2">Price</option>
</select>
</div>
</div>
</div>
</div>
<div class="tab__container">
<!--************Grid view start**************-->
<div class="shop-grid tab-pane fade show active" id="nav-grid" role="tabpanel">
<div class="row demo">
<?php
if(isset($_GET['bookid']))
{
$bookid=$_GET['bookid'];
$query="select * from categories where Parent_ID=".$bookid;
}
else
{$query="select * from categories where Parent_ID!=0";}
$record=mysqli_query($con,$query);
while($roww = mysqli_fetch_assoc($record))
{
?>
<!-- Start single SUBCAT -->
<div class="product product__style--3 col-lg-4 col-md-4 col-sm-6 col-12">
<div class="product__thumb">
<a class="first__img" href="javascript:void(0);" onclick="product(<?php echo $roww['ID']; ?>)">
<img src="../myadmin/uploads/<?php echo $roww['Image'];?>"
width="200px" height="300px" alt="product"></a>
</div><br>
<div class="text-center">
<h5><a href="javascript:void(0);" onclick="product(<?php echo $roww['ID']; ?>)">
<?php echo $roww['Name']; ?></a></h5>
</div>
</div>
<!-- End single SUBCAT -->
<?php } ?>
</div>
</div>
<!--***************LIST VIEW START******************-->
<div class="shop-grid tab-pane fade" id="nav-list" role="tabpanel">
<div class="list__view__wrapper" id="list">
<!-- Start Single Product -->
<div class="list__view mt--40">
<div class="thumb">
<a class="first__img" href="single-product.html"><img src="images/product/2.jpg" alt="product images"></a>
<a class="second__img animation1" href="single-product.html"><img src="images/product/4.jpg" alt="product images"></a>
</div>
<div class="content">
<h2><a href="javascript:void()">Blood In Water</a></h2>
<ul class="rating d-flex">
<li class="on"><i class="fa fa-star-o"></i></li>
<li class="on"><i class="fa fa-star-o"></i></li>
<li class="on"><i class="fa fa-star-o"></i></li>
<li class="on"><i class="fa fa-star-o"></i></li>
<li><i class="fa fa-star-o"></i></li>
<li><i class="fa fa-star-o"></i></li>
</ul>
<ul class="prize__box">
<li>$111.00</li>
<li class="old__prize">$220.00</li>
</ul>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam fringilla augue nec est tristique auctor. Donec non est at libero vulputate rutrum. Morbi ornare lectus quis justo gravida semper. Nulla tellus mi, vulputate adipiscing cursus eu, suscipit id nulla.</p>
<ul class="cart__action d-flex">
<li class="cart"><a href="cart.html">Add to cart</a></li>
<li class="wishlist"><a href="cart.html"></a></li>
<li class="compare"><a href="cart.html"></a></li>
</ul>
</div>
</div>
<!-- End Single Product -->
</div>
</div>
<!--...........END LIST VIEW..................-->
</div>
</div>
</div>
</div>
</div>
<!-- End Shop Page -->
<script>
$(".nav-item").hide();
function subcat(id){
$.ajax({
url:'books_dashboard.php',
type:'POST',
data:{action_type:'sub',id:id},
success:function(response){
$('.demo').html(response);
/*=========Number of products===================*/
var count=$('.product__thumb').length;
$('#count').text(count);
$(".nav-item").hide();
}
});
}
function product(id)
{
$.ajax({
url:'books_dashboard.php',
type:'POST',
dataType:'JSON',
data:{action_type:'pro',id:id},
success:function(response){
alert(response.name)[0];
/*=========Number of products===================*/
var count=$('.product__thumb').length;
$('#count').text(count);
$(".nav-item").show();
}
});
}
function price_filter()
{
var min = $('#hidden_min').val();
var max = $('#hidden_max').val();
$.ajax({
url:'books_dashboard.php',
type:'POST',
data:{action_type:'price',min:min,max:max},
success:function(response){
$('.demo').html(response);
/*=========Number of products===================*/
var count=$('.product__thumb').length;
$('#count').text(count);
$(".nav-item").show();
}
});
}
function sort()
{
var x=$('#select').val();
if(x==0||x==1)
{
location='books.php';
}
else
{
$.ajax({
url:'books_dashboard.php',
type:'POST',
data:{action_type:'sort',type:x},
success:function(response){
$('.demo').html(response);
/*=========Number of products===================*/
var count=$('.product__thumb').length;
$('#count').text(count);
$(".nav-item").show();
}
});
}
}
</script>
<?php
require "footer.php";
?>