-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcart.php
468 lines (417 loc) · 25.5 KB
/
cart.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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<?php
session_start();
if (!(isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE)) {
include 'serverPhp/remember.php';
}
require 'config.php';
$logInStatus="";
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
$logInStatus="true";
}else{
$logInStatus="false";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Cart - MuskGreen | India's Latest Digital Nursery and Organic Products store</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="bootstrap4/css/bootstrap-grid.min.css" >
<link rel="stylesheet" href="bootstrap4/css/bootstrap.min.css" >
<!-- Our CSS -->
<link rel="stylesheet" type="text/css" href="css/style.css" media="(min-width: 768px)">
<link rel="stylesheet" type="text/css" href="css/mobileNav.css" media="(max-width: 767px)">
<link rel="stylesheet" type="text/css" href="css/liveSearchStyle.css">
<link rel="stylesheet" type="text/css" href="css/footer.css">
<link rel="stylesheet" type="text/css" href="css/cartStyle.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script type="text/javascript" src="bootstrap4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/buttonActions.js"></script>
<script type="text/javascript" src="js/cartActions.js?v=1.1"></script>
<script type="text/javascript">
setLogInStatus('<?=$logInStatus?>');
function startCart(){
setCartCount('<?=$logInStatus?>');
}
</script>
<script type="text/javascript" src="js/typeahead.bundle.js"></script>
<script type="text/javascript" src="js/liveSearch.js"></script>
</head>
<!-- Top Brand Bar with Search, Login & Signup and Cart (Includes NavBar button in mobile view)-->
<nav class="navbar navbar-expand-md sticky-top navbar-light topBar d-none d-md-flex">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand py-0 topNavItem" href="index.php">
<img src="extras/musklogo224.png" width="72%" class="d-inline-block align-top" alt="MuskGreen">
</a>
<!--Search Box-->
<form autocomplete="off" class="input-group md-form form-sm form-2" action="products.php?">
<input class="autocomplete form-control my-0 py-1 amber-border typeahead tt-query" id="myInput" type="text" name="product" placeholder="Search" aria-label="Search" autocomplete="off" spellcheck="false" style="display: inline; text-align: left;">
<button class="btn btn-secondary" type="submit" style="display: inline;">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</form>
<!--Login/Signup or Account-->
<?php
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
?>
<a class="topNavItem nav-item py-0" href="profile.php"><span class="fa fa-user topNavItem" title="User Account" aria-hidden="true"> <span><br/>Account</span></span></a>
<!-- Cart -->
<a class="topNavItem nav-item py-0" href="cart.php"><span class="fa fa-shopping-cart topNavItem" title="Cart" aria-hidden="true"> <span><br/>Cart[<span id="cartCountUserDesktop"><?=$_SESSION['cartCount']?></span>]</span></span></a>
<?php
} else {
?>
<a class="topNavItem nav-item py-0" href="#" onclick="signupLogin()"><span class="fa fa-user topNavItem" title="Login Or Signup" aria-hidden="true"> <span><br/>Login/Signup</span></span></a>
<!-- Cart -->
<a class="topNavItem nav-item py-0" href="cart.php"><span class="fa fa-shopping-cart topNavItem" title="Cart" aria-hidden="true"> <span><br/>Cart[<span id="cartCountDesktop">0</span>]</span></span></a>
<?php
}
?>
</nav>
<!-- Navigation Bar -->
<nav class="navbar navbar-expand-md lowerNavBar d-none d-md-flex">
<!-- <a class="navbar-brand" href="#">Navbar</a>-->
<div class="collapse navbar-collapse navigationBar" id="navbarCollapse">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Plants
</a>
<div class="dropdown-menu dropdownMenu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="products.php?product=Succulents">Succulents</a>
<a class="dropdown-item" href="products.php?product=Ornamental">Ornamental Plants</a>
<a class="dropdown-item" href="products.php?product=Gift">Gift Plants</a>
<a class="dropdown-item" href="products.php?product=Shade">Shade Plants</a>
<a class="dropdown-item" href="products.php?product=Indoor">Indoor Plants</a>
<a class="dropdown-item" href="products.php?product=Aromatic">Aromatic Plants</a>
<a class="dropdown-item" href="products.php?product=Fruit">Fruit Plants</a>
<a class="dropdown-item" href="products.php?product=Medicinal">Medicinal Plants</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Flowers
</a>
<div class="dropdown-menu dropdownMenu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="products.php?product=Flowering">All Flowers</a>
<a class="dropdown-item" href="products.php?product=Rose">Rose Plants</a>
<a class="dropdown-item" href="products.php?product=Hibiscus">Hibiscus PLants</a>
<a class="dropdown-item" href="products.php?product=Jasmine">Jasmine Plants</a>
<a class="dropdown-item" href="products.php?product=Gazania">Gazania Plants</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Pots
</a>
<div class="dropdown-menu dropdownMenu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="products.php?product=Plastic Pots">Plastic Planters</a>
<a class="dropdown-item" href="products.php?product=Ceramic Pots">Ceramic Planters</a>
<a class="dropdown-item" href="#">Earthen Planters</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#" id="navbarDropdown" role="button" aria-haspopup="true" aria-expanded="false">Fertilizers
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link" href="#" id="navbarDropdown" role="button" aria-haspopup="true" aria-expanded="false">Soils
</a>
</li>
</ul>
</div>
</nav>
<!--Mobile Navigation Bar-->
<div class="mobileBar navigation-wrap bg-light start-header start-style d-md-none">
<div class="container">
<div class="row">
<div class="col-12">
<nav class="navbar navbar-expand-md navbar-light">
<a class="navbar-brand" href="index.php"><img src="extras/musklogo112.png" alt=""></a>
<!-- account -->
<?php
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
?>
<a class="mobileNavItem py-0" href="profile.php"><span class="fa fa-user mobileNavItem" type="" title="User Account" aria-hidden="true"></span></a>
<!-- cart -->
<a class="mobileNavItem py-0"><span class="fa fa-shopping-cart mobileNavItem" title="Cart" aria-hidden="true"><span> [<span id="cartCountUserMobile">0</span>]</span></span></a>
<?php
}else{
?>
<a class="mobileNavItem py-0" href="#" onclick="signupLogin()"><span class="fa fa-user mobileNavItem" type="" title="Login or SignUp" aria-hidden="true"></span></a>
<!-- cart -->
<a class="py-0 mobileNavItem" href="cart.php"><span class="fa fa-shopping-cart mobileNavItem" title="Cart" aria-hidden="true"><span> [<span id="cartCountMobile">0</span>]</span></span></a>
<?php
}
?>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto py-4 py-md-0">
<li class="nav-item pl-4 pl-md-0 ml-0 ml-md-4">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Plants</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="products.php?product=Succulents">Succulents</a>
<a class="dropdown-item" href="products.php?product=Ornamental">Ornamental Plants</a>
<a class="dropdown-item" href="products.php?product=Shade">Shade Plants</a>
<a class="dropdown-item" href="products.php?product=Indoor">Indoor Plants</a>
<a class="dropdown-item" href="products.php?product=Aromatic">Aromatic Plants</a>
<a class="dropdown-item" href="products.php?product=Fruit">Fruit Plants</a>
<a class="dropdown-item" href="products.php?product=Medicinal">Medicinal Plants</a>
<a class="dropdown-item" href="products.php?product=Gift">Gift Plants</a>
<a class="dropdown-item" href="products.php?product=Plants">All Plants</a>
</div>
</li>
<li class="nav-item pl-4 pl-md-0 ml-0 ml-md-4">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Flowers</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="products.php?product=Flowering">All Flowers</a>
<a class="dropdown-item" href="products.php?product=Rose">Rose Plants</a>
<a class="dropdown-item" href="products.php?product=Hibiscus">Hibiscus PLants</a>
<a class="dropdown-item" href="products.php?product=Jasmine">Jasmine Plants</a>
<a class="dropdown-item" href="products.php?product=Gazania">Gazania Plants</a>
</div>
</li>
<li class="nav-item pl-4 pl-md-0 ml-0 ml-md-4">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Pots</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="products.php?product=Plastic Pots">Plastic Planters</a>
<a class="dropdown-item" href="products.php?product=Ceramic Pots">Ceramic Planters</a>
<a class="dropdown-item" href="#">Earthen Planters</a>
</div>
</li>
<li class="nav-item pl-4 pl-md-0 ml-0 ml-md-4">
<a class="nav-link" href="#">Fertilizers</a>
</li>
<li class="nav-item pl-4 pl-md-0 ml-0 ml-md-4">
<a class="nav-link" href="#">Soils</a>
</li>
</ul>
</div>
<!--Search Box (Mobile)-->
<form autocomplete="off" class="mobileSearchBar input-group md-form form-sm form-2 pl-0 d-md-none" action="products.php?">
<input class="autocomplete form-control py-0 amber-border typeahead tt-query" id="myInput2" type="text" name="product" placeholder="Search Plants, Pots and More..." aria-label="Search" autocomplete="off" spellcheck="false">
<button class="btn btn-secondary" type="submit" style="display: inline;">
<i class="fa fa-search" aria-hidden="true"></i>
</button>
</form>
</nav>
</div>
</div>
</div>
</div>
<!-- Main Content Starts -->
<div class="px-4 px-lg-0">
<div class="container productContainer">
<div class="row">
<div class="col-lg-12 bg-white rounded mb-5 cartBox cartProductsBox" style="">
<h4 style="display: inline-block;">Your MuskGreen Cart</h4><h4 style="display: inline-block; float: right;"><button type="button" class="btn btn-success" id="orderSummaryButton">Cart Summary <i class="fa fa-caret-down" aria-hidden="true"></i></button></h4>
<!-- Shopping cart table -->
<table class="table table-bordered table-striped table-responsive-stack" id="tableOne">
<thead class="thead-dark">
<tr>
<th scope="col" class="border-0 bg-light">
<div class="p-2 px-3 text-uppercase">Product</div>
</th>
<th scope="col" class="border-0 bg-light">
<div class="py-2 text-uppercase">Price</div>
</th>
<th scope="col" class="border-0 bg-light">
<div class="py-2 text-uppercase">Quantity</div>
</th>
<th scope="col" class="border-0 bg-light">
<div class="py-2 text-uppercase">Action</div>
</th>
</tr>
</thead>
<?php
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
?>
<tbody>
<?php
$sql="SELECT * FROM usercart NATURAL JOIN product NATURAL JOIN productseller WHERE uid = '".$_SESSION['userId']."' ORDER BY proname";
$result=$conn->query($sql);
$itemsCount=0;
while ($row=$result->fetch_assoc()) {
$itemsCount=$itemsCount+1;
?>
<tr>
<th scope="row" class="border-0">
<div class="p-2">
<img src="<?=$row['proimgurl']?>" alt="" width="60" class="img-fluid rounded shadow-sm"><br/>
<div class="d-inline-block">
<h5 class="mb-0"> <a href="#" class="text-dark d-inline-block"><?=$row['proname']?></a></h5>
</div>
</div>
</th>
<td class="border-0 align-middle"><strong>₹<?=$row['sp']?></strong></td>
<td class="border-0 align-middle">
<strong>
<form style="display: inline-block; max-width: 100px;">
<select class="form-control" onchange="triggerQuantityChange('<?=$row['proid']?>', this)">
<?php
for ($i=1; $i <= 10; $i++) {
if ($i==$row['quantity']) {
echo "<option value=\"".$i."\" selected>".$i."</option>";
}else{
echo "<option value=\"".$i."\">".$i."</option>";
}
}
?>
</select>
</form>
</strong>
</td>
<td class="border-0 align-middle"><a href="#" onclick="deleteProduct('<?=$row['proid']?>')" class="text-dark" title="Remove Product"><i class="fa fa-trash fa-lg" style="color: #D32F2F !important;" title="Remove Product"></i></a></td>
</tr>
<?php
}
if ($itemsCount === 0) {
echo "
<div class=\"d-flex justify-content-center\">
<i class=\"fa fa-leaf fa-3x\" aria-hidden=\"true\" style=\"color: #509534;\"></i><br/>
<h3 style=\"color: #509534;\">Oops.. Nothing Green Here</h3>
</div>";
}
?>
</tbody>
<?php
} else {
?>
<tbody id="nonLoggedUserCart">
</tbody>
<!-- Show a loader -->
<?php
}
?>
</table>
<!-- End -->
<div class="col-lg py-1 text-center buyBox" role="group">
<div class="btn-group btn-group-lg">
<a href="products.php" class="btn btn-secondary">< Continue Shopping</a>
<?php
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
if (intval($_SESSION['cartCount'])>0) {
?>
<a href="checkout.php" class="btn btn-danger checkoutButton">Proceed to Checkout ></a>
<?php
}
} else {
?>
<a href="#" onclick="signupLogin()" class="btn btn-danger checkoutButton">Login to Checkout ></a>
<?php
}
?>
</div>
</div>
</div>
</div>
<div class="row py-5 p-4 bg-white rounded cartBox">
<div class="col-lg-6">
<div class="bg-light rounded-pill px-4 py-3 text-uppercase font-weight-bold">Coupon code</div>
<div class="p-4">
<p class="font-italic mb-4">If you have a coupon code, please enter it in the box below</p>
<div class="input-group mb-4 border rounded-pill p-2">
<input type="text" placeholder="Apply coupon" aria-describedby="button-addon3" class="form-control border-0 applyCouponText">
<div class="input-group-append border-0">
<button id="button-addon3" type="button" class="btn btn-success px-4 rounded-pill"><i class="fa fa-gift mr-2"></i>Apply coupon</button>
</div>
</div>
</div>
</div>
<div class="col-lg-6" id="orderSummary">
<div class="bg-light rounded-pill px-4 py-3 text-uppercase font-weight-bold">Order summary </div>
<div class="p-4">
<p class="font-italic mb-4">Shipping and additional costs are calculated based on values you have entered.</p>
<ul class="list-unstyled mb-4">
<li class="d-flex justify-content-between py-3 border-bottom"><strong class="text-muted">Order Subtotal </strong><strong><span id="cartSubtotal"></span></strong></li>
<li class="d-flex justify-content-between py-3 border-bottom"><strong class="text-muted">Shipping and handling</strong><strong><span id="cartDeliveryCharges"></span></strong></li>
<li class="d-flex justify-content-between py-3 border-bottom"><strong class="text-muted">Tax</strong><strong>₹0.00</strong></li>
<li class="d-flex justify-content-between py-3 border-bottom"><strong class="text-muted">Total</strong>
<h5 class="font-weight-bold"><span id="totalCartCharges"></span></h5>
</li>
</ul>
<?php
if (isset($_SESSION['isLoggedIn']) && $_SESSION['isLoggedIn']===TRUE) {
if ($_SESSION['cartCount']==0) {
//nothing in cart
echo "<a href=\"#\" class=\"btn btn-secondary rounded-pill py-2 btn-block\">Proceed to Checkout</a>";
}else{
echo "<a href=\"checkout.php\" class=\"btn btn-dark rounded-pill py-2 btn-block checkoutButton\">Proceed to Checkout</a>";
}
}else {
echo "<a href=\"#\" class=\"btn btn-secondary rounded-pill py-2 btn-block\" onclick=\"signupLogin()\">Proceed to Checkout</a>";
}
?>
</div>
</div>
</div>
</div>
</div>
<!--Footer-->
<footer class="footer">
<div class="container bottom_border">
<div class="row">
<div class=" col-sm-4 col-md col-sm-4 col-12 col">
<h5 class="headin5_amrc col_white_amrc pt2">Find us</h5>
<!--headin5_amrc-->
<p class="mb10"> MuskGreen is a startup nestled in the Himalayan foothill city - Dehradun. We provide a platform to deliver our customers the large variety of plants and the best of organic products.</p>
<p><i class="fa fa-location-arrow"></i> 34, Kunj Vihar, Dehradun, Uttarakhand - 248001 </p>
<p><i class="fa fa fa-envelope"></i> info@muskgreen.live </p>
</div>
<div class=" col-sm-4 col-md col-6 col">
<h5 class="headin5_amrc col_white_amrc pt2">Quick links</h5>
<!--headin5_amrc-->
<ul class="footer_ul_amrc">
<li><a href="#">Buy Plants</a></li>
<li><a href="#">Buy Organic Products</a></li>
<li><a href="#">Buy Pots</a></li>
<li><a href="#">Gifts</a></li>
<li><a href="#">Offer Zone</a></li>
<li><a href="sitemap.html">Site Map</a></li>
</ul>
</div>
<div class=" col-sm-4 col-md col-6 col">
<h5 class="headin5_amrc col_white_amrc pt2">Resources</h5>
<ul class="footer_ul_amrc">
<li><a href="#">About us</a></li>
<li><a href="#">Contact us</a></li>
<li><a href="#">Wholesale</a></li>
<li><a href="#">Product Guarantee</a></li>
<li><a href="#">Customer Reviews</a></li>
<li><a href="privacyPolicy.html">Privacy Policy</a></li>
<li><a href="termsAndConditions.html">Terms & Conditions</a></li>
</ul>
</div>
</div>
</div>
<div class="container">
<ul class="foote_bottom_ul_amrc">
<li><a href="index.php">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="products.php">Products</a></li>
<li><a href="#">Sellers</a></li>
</ul>
<p class="text-center">Copyright @2019 | Made with love and care by <a href="#">MuskGreen</a></p>
<ul class="social_footer_ul">
<li><a href="#"><i class="fa fa-facebook-f"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-linkedin"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
</ul>
</div>
</footer>
<!-- Main Body Ends -->
<script type="text/javascript" src="js/styler.js"></script>
</body>
</html>