-
Notifications
You must be signed in to change notification settings - Fork 1
/
category-details.php
130 lines (82 loc) · 2.5 KB
/
category-details.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
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Category - GranthaKoshaya</title>
<link rel="stylesheet" href="style.css" />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,200&display=swap"
rel="stylesheet" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="icon" type="image/x-icon" href="images\icon.png">
</head>
<body>
<div class="header">
<div class="container">
<?php include_once("components/header.php");?>
</div>
</div>
<div class="container">
<?php include_once("src/functions.php");?>
</div>
<br>
<div class="title">
<h1><?php echo $_GET['category'];?></h1>
</div>
<?php
global $db;
$query = "SELECT p.id,p.img,p.name,p.stars,p.price FROM category c,product p where c.cat_id=p.cat_id AND c.cat_name='".$_GET['category']."'";
$result = mysqli_query($db,$query);
$count=0;
echo'<div class="row">';
while($row = mysqli_fetch_assoc($result)){
$back_path = explode("images",$row["img"]);
$pid=$row["id"];
echo'
<div class="col-4" style="padding-left: 30px;">
<a href="product-details.php?productid='.$pid.'">
<img src="images' . $back_path[1].'" alt="image" style="
height:320px;
object-fit: cover;
width:250px;
"/>
</a>
<h4>'.$row['name'].'</h4>
<div class="rating">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-o"></i>
</div>
<p>Rs.'.$row['price'].'</p>
</div>';
$count++;
if (
$count % 4==0
)
{
echo'</div><div class="row">';
}
}
echo'</div>';
?>
<!-- Footer -->
<div style="height:300px !important;"></div>
<?php include_once("components/footer.php");?>
<!-- JS for Toggle menu -->
<script>
var MenuItems = document.getElementById("MenuItems");
MenuItems.style.maxHeight = "0px";
function menutoggle() {
if (MenuItems.style.maxHeight == "0px") {
MenuItems.style.maxHeight = "200px";
} else {
MenuItems.style.maxHeight = "0px";
}
}
</script>
</body>
</html>