-
Notifications
You must be signed in to change notification settings - Fork 1
/
home.php
232 lines (159 loc) · 10 KB
/
home.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
<?php
session_start();
require "connection.php";
?>
<!DOCTYPE html>
<html>
<head>
<title>Home | mkshop</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bootstrap.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
<link rel="stylesheet" href="style.css" />
<link rel="icon" href="resourses/logo.svg" />
</head>
<body>
<div class="container-fluid">
<div class="row">
<?php include "header.php"; ?>
<hr />
<div class="col-12 justify-content-center">
<div class="row mb-3">
<div class="offset-4 offset-lg-1 col-4 col-lg-1 logo" style="height: 60px;"></div>
<div class="col-12 col-lg-6">
<div class="input-group mb-3 mt-3">
<input type="text" id="kw" class="form-control" aria-label="Text input with dropdown button" />
<select class="form-select" style="max-width: 250px;" id="c">
<option value="0">All Categories</option>
<?php
$category_rs = Database::search("SELECT * FROM `category`");
$category_num = $category_rs->num_rows;
for ($x = 0; $x < $category_num; $x++) {
$category_data = $category_rs->fetch_assoc();
?>
<option value="<?php echo $category_data["cat_id"]; ?>">
<?php echo $category_data["cat_name"]; ?>
</option>
<?php
}
?>
</select>
</div>
</div>
<div class="col-12 col-lg-2 d-grid">
<button class="btn btn-primary mt-3 mb-3" onclick="basicSearch(0);">Search</button>
</div>
<div class="col-12 col-lg-2 mt-2 mt-lg-4 text-center text-lg-start">
<a href="advancedSearch.php" class="text-decoration-none link-secondary fw-bold">Advanced</a>
</div>
</div>
</div>
<hr />
<div class="col-12" id="basicSearchResult">
<div class="row">
<!-- Carousel -->
<div id="carouselExampleCaptions" class="offset-2 col-8 carousel slide carousel-fade" data-bs-ride="carousel">
<div class="carousel-indicators">
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button>
<button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button>
</div>
<div class="carousel-inner">
<div class="carousel-item active" data-bs-interval="1000">
<img src="resourses/slider images/posterimg.jpg" class="d-block poster-img-1" />
<div class="carousel-caption d-none d-md-block poster-caption">
<h5 class="poster-title">Welcome to mkshop</h5>
<p class="poster-txt">The World's Best Online Store By One Click.</p>
</div>
</div>
<div class="carousel-item" data-bs-interval="1000">
<img src="resourses/slider images/posterimg2.jpg" class="d-block poster-img-1" />
</div>
<div class="carousel-item" data-bs-interval="1000">
<img src="resourses/slider images/posterimg3.jpg" class="d-block poster-img-1" />
<div class="carousel-caption d-none d-md-block poster-caption-1">
<h5 class="poster-title">Be Free.....</h5>
<p class="poster-txt">Experience the Lowest Delivery Costs With Us.</p>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
<!-- Carousel -->
<?php
$c_rs = Database::search("SELECT * FROM `category`");
$c_num = $c_rs->num_rows;
for ($y = 0; $y < $c_num; $y++) {
$c_data = $c_rs->fetch_assoc();
?>
<!-- category names -->
<div class="col-12 mt-3 mb-3">
<a href="#" class="text-decoration-none text-dark fs-3 fw-bold">
<?php echo $c_data["cat_name"]; ?>
</a>
<a href="#" class="text-decoration-none text-dark fs-6">See All →</a>
</div>
<!-- category names -->
<!-- products -->
<div class="col-12 mb-3">
<div class="row border border-primary">
<div class="col-12">
<div class="row justify-content-center gap-2">
<?php
$product_rs = Database::search("SELECT * FROM `product` WHERE
`category_cat_id`='" . $c_data['cat_id'] . "' AND `status_status_id`='1' ORDER BY
`datetime_added` DESC LIMIT 4 OFFSET 0");
$product_num = $product_rs->num_rows;
for ($x = 0; $x < $product_num; $x++) {
$product_data = $product_rs->fetch_assoc();
?>
<div class="card col-12 col-lg-2 mt-2 mb-2" style="width: 18rem;">
<?php
$img_rs = Database::search("SELECT * FROM `product_img` WHERE
`product_id`='" . $product_data['id'] . "'");
$img_data = $img_rs->fetch_assoc();
?>
<img src="<?php echo $img_data["img_path"]; ?>" class="card-img-top img-thumbnail mt-2" style="height: 180px;" />
<div class="card-body ms-0 m-0 text-center">
<h5 class="card-title fw-bold fs-6"><?php echo $product_data["title"]; ?></h5>
<span class="badge rounded-pill text-bg-info">New</span><br />
<span class="card-text text-primary">Rs. <?php echo $product_data["price"]; ?> .00</span><br />
<span class="card-text text-warning fw-bold">In Stock</span><br />
<span class="card-text text-success fw-bold"><?php echo $product_data["qty"]; ?> Items Available</span><br />
<a href="<?php echo "singleProductView.php?id=". ($product_data["id"]); ?>" class="col-12 btn btn-success">Buy Now</a>
<button class="col-12 btn btn-dark mt-2" onclick="addToCart(<?php echo $product_data['id'];?>);">
<i class="bi bi-cart4 text-white fs-5"></i>
</button>
<button onclick="addToWatchlist(<?php echo $product_data['id'];?>);" class="col-12 btn btn-outline-light mt-2 border border-primary">
<i class="bi bi-heart-fill text-dark fs-5"></i>
</button>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<!-- products -->
<?php
}
?>
</div>
</div>
<?php include "footer.php"; ?>
</div>
</div>
<script src="bootstrap.bundle.js"></script>
<script src="script.js"></script>
</body>
</html>