-
Notifications
You must be signed in to change notification settings - Fork 2
/
shop.php
329 lines (289 loc) · 17.1 KB
/
shop.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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?php require "includes/header.php"; ?>
<?php require "config/config.php"; ?>
<?php
// categories
$categories = $conn->query("SELECT * FROM categories");
$categories->execute();
$allCategories = $categories->fetchAll(PDO::FETCH_OBJ);
//most wanted products
$mostProducts = $conn->query("SELECT * FROM products WHERE status = 1"); //only grab available products
$mostProducts->execute();
$allmostProducts = $mostProducts->fetchAll(PDO::FETCH_OBJ);
//veggies
$veggies = $conn->query("SELECT * FROM products WHERE status = 1 AND category_id = 1"); //id for categories shoul match category_id for products
$veggies->execute();
$allveggies = $veggies->fetchAll(PDO::FETCH_OBJ);
//meat
$meats = $conn->query("SELECT * FROM products WHERE status = 1 AND category_id = 2"); //id for categories shoul match category_id for products
$meats->execute();
$allMeats = $meats->fetchAll(PDO::FETCH_OBJ);
//FISH
$fishes = $conn->query("SELECT * FROM products WHERE status = 1 AND category_id = 3"); //id for categories shoul match category_id for products
$fishes->execute();
$allFishes = $fishes->fetchAll(PDO::FETCH_OBJ);
//FRUITS
$fruits = $conn->query("SELECT * FROM products WHERE status = 1 AND category_id = 4"); //id for categories shoul match category_id for products
$fruits->execute();
$allFruits = $fruits->fetchAll(PDO::FETCH_OBJ);
?>
<div id="page-content" class="page-content">
<div class="banner">
<div class="jumbotron jumbotron-bg text-center rounded-0" style="background-image: url('assets/img/bg-header.jpg');">
<div class="container">
<h1 class="pt-5">
Shopping Page
</h1>
<p class="lead">
Save time and leave the groceries to us.
</p>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="shop-categories owl-carousel mt-5">
<?php foreach($allCategories as $category) : ?>
<div class="item">
<a href="shop.php">
<div class="media d-flex align-items-center justify-content-center">
<span class="d-flex mr-2"><i class="sb-<?php echo $category->icon; ?>"></i></span>
<div class="media-body">
<h5><?php echo $category->name; ?></h5>
<p><?php echo $category->description; ?></p>
</div>
</div>
</a>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
<section id="most-wanted">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Most Wanted</h2>
<div class="product-carousel owl-carousel">
<?php foreach($allmostProducts as $allmostProducts) : ?>
<div class="item">
<div class="card card-product">
<div class="card-ribbon">
<div class="card-ribbon-container right">
<span class="ribbon ribbon-primary">SPECIAL</span>
</div>
</div>
<div class="card-badge">
<div class="card-badge-container left">
<span class="badge badge-default">
Until <?php echo $allmostProducts->exp_date; ?>
</span>
<span class="badge badge-primary">
20% OFF
</span>
</div>
<img src="<?php echo IMGURLPRODUCT; ?>/<?php echo $allmostProducts->image; ?>" alt="Card image 2" class="card-img-top">
</div>
<div class="card-body">
<h4 class="card-title">
<a href="detail-product.php"><?php echo $allmostProducts->title; ?></a>
</h4>
<div class="card-price">
<!-- <span class="discount">ksh. 600.000</span> -->
<span class="reguler">ksh. <?php echo $allmostProducts->price; ?></span>
</div>
<a href="<?php echo APPURL; ?>/products/detail-product.php?id=<?php echo $allmostProducts->id; ?>" class="btn btn-block btn-primary">
Add to Cart
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<section id="meats">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Meats</h2>
<div class="product-carousel owl-carousel">
<?php foreach($allMeats as $meat) : ?>
<div class="item">
<div class="card card-product">
<div class="card-ribbon">
<div class="card-ribbon-container right">
<span class="ribbon ribbon-primary">SPECIAL</span>
</div>
</div>
<div class="card-badge">
<div class="card-badge-container left">
<span class="badge badge-default">
Until <?php echo $meat->exp_date; ?>
</span>
<span class="badge badge-primary">
20% OFF
</span>
</div>
<img src="<?php echo IMGURLPRODUCT; ?>/meats.jpg ?>" alt="Card image 2" class="card-img-top">
</div>
<div class="card-body">
<h4 class="card-title">
<a href="detail-product.html"><?php echo $meat->title; ?></a>
</h4>
<div class="card-price">
<span class="discount">ksh. 12000.00</span>
<span class="reguler">ksh. <?php echo $meat->price; ?></span>
</div>
<a href="<?php echo APPURL; ?>/products/detail-product.php?id=<?php echo $meat->id; ?>" class="btn btn-block btn-primary">
Add to Cart
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<section id="fishes" class="gray-bg">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Fishes</h2>
<div class="product-carousel owl-carousel">
<?php foreach($allFishes as $fish) : ?>
<div class="item">
<div class="card card-product">
<div class="card-ribbon">
<div class="card-ribbon-container right">
<span class="ribbon ribbon-primary">SPECIAL</span>
</div>
</div>
<div class="card-badge">
<div class="card-badge-container left">
<span class="badge badge-default">
Until <?php echo $fish->exp_date; ?>
</span>
<span class="badge badge-primary">
20% OFF
</span>
</div>
<img src="<?php echo IMGURLPRODUCT; ?>/<?php echo $fish->image; ?>" alt="Card image 2" class="card-img-top">
</div>
<div class="card-body">
<h4 class="card-title">
<a href="detail-product.html"><?php echo $fish->title; ?></a>
</h4>
<div class="card-price">
<span class="discount">ksh 1200.000</span>
<span class="reguler">ksh. <?php echo $fish->price; ?></span>
</div>
<a href="<?php echo APPURL; ?>/products/detail-product.php?id=<?php echo $fish->id; ?>" class="btn btn-block btn-primary">
Add to Cart
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<section id="fruits">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Fruits</h2>
<div class="product-carousel owl-carousel">
<?php foreach($allFruits as $fruit) : ?>
<div class="item">
<div class="card card-product">
<div class="card-ribbon">
<div class="card-ribbon-container right">
<span class="ribbon ribbon-primary">SPECIAL</span>
</div>
</div>
<div class="card-badge">
<div class="card-badge-container left">
<span class="badge badge-default">
Until <?php echo $fruit->exp_date; ?>
</span>
<span class="badge badge-primary">
20% OFF
</span>
</div>
<img src="<?php echo IMGURLPRODUCT; ?>/<?php echo $fruit->image; ?>" alt="Card image 2" class="card-img-top">
</div>
<div class="card-body">
<h4 class="card-title">
<a href="detail-product.html"><?php echo $fruit->title; ?></a>
</h4>
<div class="card-price">
<span class="discount">ksh 500.000</span>
<span class="reguler">ksh. <?php echo $fruit->price; ?></span>
</div>
<a href="<?php echo APPURL; ?>/products/detail-product.php?id=<?php echo $fruit->id; ?>" class="btn btn-block btn-primary">
Add to Cart
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
<section id="vegetables" class="gray-bg">
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Vegetables</h2>
<div class="product-carousel owl-carousel">
<?php foreach($allveggies as $allveggy) : ?>
<div class="item">
<div class="card card-product">
<div class="card-ribbon">
<div class="card-ribbon-container right">
<span class="ribbon ribbon-primary">SPECIAL</span>
</div>
</div>
<div class="card-badge">
<div class="card-badge-container left">
<span class="badge badge-default">
Until <?php echo $allveggy->exp_date ?>
</span>
<span class="badge badge-primary">
20% OFF
</span>
</div>
<img src="<?php echo IMGURLPRODUCT; ?>/<?php echo $allveggy->image; ?>" alt="Card image 2" class="card-img-top">
</div>
<div class="card-body">
<h4 class="card-title">
<a href="detail-product.php"><?php echo $allveggy->title; ?></a>
</h4>
<div class="card-price">
<span class="discount">ksh 400</span>
<span class="reguler">ksh. <?php echo $allveggy->price; ?></span>
</div>
<a href="<?php echo APPURL; ?>/products/detail-product.php?id=<?php echo $allveggy->id; ?>" class="btn btn-block btn-primary">
Add to Cart
</a>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
</section>
</div>
<?php require "includes/footer.php"; ?>