-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproductbycat.php
112 lines (78 loc) · 2.42 KB
/
productbycat.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
<?php include 'inc/header.php';?>
<?php
if (!isset($_GET['catId']) || $_GET['catId'] == NULL) {
echo "<script> window.location = '404.php'; </script>";
} else {
$id = preg_replace('/[^-a-zA-Z0-9_]/', '', $_GET['catId']);
}
?>
<div class="main">
<div class="content">
<div class="content_top">
<div class="heading">
<h3>Choose Category:</h3>
</div>
<div class="clear"></div>
</div>
<div class="section group sidecat j_c_center ">
<ul class="center">
<?php
$getCat = $cat->getAllCat();
if ($getCat) {
while ($result = $getCat->fetch_assoc()) {
?>
<li class="flex-direction">
<a href="productbycat.php?catId=<?php echo $result['catId'];?>">
<?php echo $result['catName'];?>
<i class="fas fa-chevron-down"> </i>
</a>
</li>
<?php } } ?>
</ul>
</div>
</div>
<div class="content_top">
<div class="heading">
<?php
$namebycat = $cat->getCatNameById($id);
if ($namebycat ) {
while ($result = $namebycat->fetch_assoc() ) {
?>
<h3> <?php echo $result['catName'];?>
<?php } }?>
<?php
$productofcat = $pd->countProductOfCat($id);
if ($productofcat ) {
while ($result = $productofcat->fetch_assoc() ) {
?>
<b> (<?php echo $result['Total'];?> Book/s) <b>
<?php } }?>
</h3>
</div>
<div class="clear"></div>
</div>
<div class="section group">
<?php
$productbycat = $pd->productByCat($id);
if ($productbycat) {
while ($result = $productbycat->fetch_assoc()) {
?>
<div class="grid_1_of_4 images_1_of_4">
<a href="details.php?proid=<?php echo $result['productId'] ;?>">
<img src="admin/<?php echo $result['image'] ;?>" class="img_cng" alt=""/>
</a>
<h2> <?php echo $result['productName'] ;?> </h2>
<p><?php echo $fm->textShorten($result['body'], 60) ;?> </p>
<p><span class="price">Tk <?php echo $result['price'] ;?></span></p>
<div class="button"> <span>
<a href="details.php?proid=<?php echo $result['productId'] ;?>"
class="details">Details</a>
</span> </div>
</div>
<?php } } else {
echo "<h3> This category has no products available! </h3>";
} ?>
</div>
</div>
</div>
<?php include 'inc/footer.php';?>