forked from sajjadsaleem341/Plant-Nest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart.php
112 lines (106 loc) · 4.63 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
<?php
include 'header.php';
?>
<!-- ##### Breadcrumb Area Start ##### -->
<div class="breadcrumb-area">
<!-- Top Breadcrumb Area -->
<div class="top-breadcrumb-area bg-img bg-overlay d-flex align-items-center justify-content-center" style="background-image: url(img/bg-img/24.jpg);">
<h2>Cart</h2>
</div>
<div class="container">
<div class="row">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="#"><i class="fa fa-home"></i> Home</a></li>
<li class="breadcrumb-item active" aria-current="page">Cart</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<!-- ##### Breadcrumb Area End ##### -->
<!-- ##### Cart Area Start ##### -->
<div class="cart-area section-padding-0-100 clearfix">
<div class="container">
<div class="row">
<div class="col-12">
<div class="cart-table clearfix">
<table class="table table-responsive">
<thead>
<tr>
<th>Products</th>
<th>Quantity</th>
<th>Price</th>
<th>TOTAL</th>
<th></th>
</tr>
</thead>
<tbody>
<?php
if(isset($_SESSION['cart'])){
$cart_total=0;
foreach($_SESSION['cart'] as $key=>$val){
$productArr=get_product($con,'','',$key);
$image=$productArr[0]['Image'];
$pname=$productArr[0]['Name'];
$price=$productArr[0]['Price'];
$qty=$val['qty'];
$cart_total=$cart_total+($price*$qty);
?>
<tr>
<td class="cart_product_img">
<a href="#"><img src="./image/<?= $image ?>" alt="Product"></a>
<h5><?= $pname?></h5>
</td>
<td class="price"><span><?= $qty?></span></td>
<td class="price"><span>$<?= $price?></span></td>
<td class="total_price"><span>$<?= $qty*$price ?></span></td>
<td class="action"><a href="javascript:void(0)" onclick="manage_cart('<?php echo $key?>','remove')"><i class="icon_close"></i></a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<!-- Cart Totals -->
<div class="col-12 col-lg-6">
<div class="cart-totals-area mt-70">
<h5 class="title--">Cart Total</h5>
<div class="subtotal d-flex justify-content-between">
<h5>Subtotal</h5>
<h5>$<?= $cart_total ?></h5>
</div>
<div class="subtotal d-flex justify-content-between">
<h5>Shipping</h5>
<h5>$<?= round($cart_total*2/100) ?></h5>
</div>
<div class="total d-flex justify-content-between">
<h5>Total</h5>
<h5>$<?= round($cart_total * 2 / 100 + $cart_total) ?></h5>
</div>
<div class="checkout-btn">
<?php
if(!isset($_SESSION['USER_LOGIN'])){
echo '<a href="#myModal" data-toggle="modal" class="btn alazea-btn w-100">PROCEED TO CHECKOUT</a>';
}
else{
echo '<a href="checkout.php" class="btn alazea-btn w-100">PROCEED TO CHECKOUT</a>';
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- ##### Cart Area End ##### -->
<?php
include 'footer.php';
?>