-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearch.php
165 lines (124 loc) · 5.4 KB
/
search.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
<?php
session_start();
include('database/DBcontroller.php');
if(isset($_GET['category'])){
$cat_name = $_GET['category'];
}
if(isset($_GET['cat_id'])){
$cat_id = $_GET['cat_id'];
}
$f_cat_sql = "SELECT * FROM `catagory` WHERE cat_name='$cat_name' AND cat_id='$cat_id'";
$f_cat_result = mysqli_query($con, $f_cat_sql);
if(mysqli_num_rows($f_cat_result)>0){
}else{
?>
<script>
location.replace('index.php');
</script>
<?php
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tamai Food cart- Fastest fresh fast food restaurent</title>
<!-- Incluidng head links -->
<?php
include("_partial-temp/_head-link.php");
?>
</head>
<body>
<?php
// INCLUDING NAV MENU LOADER AND TOP
include("_partial-temp/_nav.php");
?>
<!-- main section starts -->
<main>
<!-- page banner starts -->
<div class="page-banner" style="background-image: url('resources/img/about-bg.jpg');">
<h1 class="banner-text">
<?php echo $cat_name; ?>
</h1>
</div>
<!-- page banner Ends -->
<div class="container-fluid py-5">
<div>
<a href="index.php">Home</a> /
<?php echo $cat_name;?>
</div>
<div class="item-container mt-5">
<!-- food item card -->
<?php
$sql = "SELECT * FROM `item_info` WHERE item_cat_id IN ($cat_id) ORDER BY item_id DESC";
$result = mysqli_query($con, $sql);
if(mysqli_num_rows($result)>0){
while($row = mysqli_fetch_assoc($result)){
$price = $row["item_price"];
$discount = $row["item_discount"];
$disPrice = ($price * $discount)/100;
$disPrice = round($price - $disPrice );
$rating = $row["item_rating"];
$cat_id = $row["item_cat_id"];
$cat_sql = "SELECT * FROM `catagory` WHERE cat_id = '$cat_id'";
$cat_result = mysqli_query($con,$cat_sql);
if(mysqli_num_rows($cat_result)>0){
$cat_row = mysqli_fetch_assoc($cat_result);
$category = $cat_row["cat_name"];
}else{
$category = "Uncategorized";
};
?>
<div class="food-item">
<div class="item-img-div">
<!-- food img -->
<img src="<?php echo $adRedirect."resources/img/item_img/".$row["item_img"];?>" alt="" class="item-img">
<!-- item info -->
<a href="item.php?item_id=<?php echo $row["item_id"]?>" class="item-detail-link"><i class=" fa fa-search"></i></a>
</div>
<div class="discount">
-<?php echo $discount?>%
</div>
<div class="item-info">
<div class="item-name">
<!-- item name -->
<?php echo ucfirst(strtolower($row['item_name'])) ?>
</div>
<div class="item-pri-cat">
<!-- item category -->
<div class="item-catagory"><?php echo @$category?></div>
<!-- item price -->
<div class="price">
<div class="del-price">৳<?php echo $price?></div>
<div class="c-price">৳<?php echo @$disPrice?></div>
</div>
</div>
</div>
<div class="item-card-footer">
<div class="item-rate">
<div class="rating">
<!-- deal rating -->
<?php include($adRedirect)."_partial-temp/_item-rating.php"?>
</div>
<div class="item-review"> <?php echo $row["item_t_review"]?> Reviews</div>
</div>
</div>
</div>
<?php
} //end of while
}else{ //end of if
echo "<h1 class='text-red m-auto'>There is no item for this Category</h1>";
}
?>
</div>
</div>
</main>
<!-- main section Ends -->
<!-- INCLUDING FOOTER AND JS LINKS -->
<?php
include("_partial-temp/_footer.php");
?>
</body>
</html>