-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathcart.php
215 lines (209 loc) · 8.69 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
<?php
require('require/top.php');
$cart=get_cart_products($con);
$total_subtotal=0;
// print_r($_SESSION['USER_CART']);
?>
<div class="path">
<div class="container">
<a href="index.php">Home</a>
/
<a href="cart.php">Cart</a>
</div>
</div>
<section class="cart">
<section class="myac-body">
<div class="flex row">
<div class="right">
<div class="col-lg-12 col-md-12">
<div class="pdpt-bg">
<div class="pdpt-title flex justify-between">
<h4>
<i class="uil uil-shopping-cart-alt"></i> My Cart
</h4>
</div>
<div class="order-body10">
<table>
<thead>
<th>
<h5>Product</h5>
</th>
<th>
<h5>Price</h5>
</th>
<th>
<h5>Quantity</h5>
</th>
<th>
<h5>Subtotal</h5>
</th>
<th>
<h5>Delete</h5>
</th>
</thead>
<tbody>
<?php
if(count($cart)>0){
foreach($cart as $product){
if(!isset($_SESSION['USER_LOGIN'])){
$p_qy=$product['product_qty'];
}else{
$p_qy=$product['qty'];
}
?>
<tr>
<td>
<div class="product">
<a href="">
<img src="media/product/<?php echo $product['img1'] ?>" alt="" />
</a>
<h6><?php echo $product['product_name'] ?></h6>
</div>
</td>
<td>
<div class="price">
<h6>₹<?php echo $product['fa'] ?></h6>
</div>
</td>
<td>
<div class="qty">
<div class="box">
<input type="text" value="<?php echo $p_qy; ?>" />
<div class="btnbv">
<button
onclick="inc(this,<?php echo $product['id']; ?>)">+</button>
<button
onclick="de_sc(this,<?php echo $product['id']; ?>)">-</button>
</div>
</div>
</div>
</td>
<td>
<div class="price">
<h6>₹<?php
$sftp=$p_qy*$product['fa'];
$total_subtotal+=$sftp;
echo $sftp;
?></h6>
</div>
</td>
<td>
<div class="price">
<h6>
<i class="uil uil-trash-alt"
onclick="del_cart(<?php echo $product['id'] ?>)"></i>
</h6>
</div>
</td>
</tr>
<?php }} ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="left">
<div class="ul-wrapper">
<h4>Cart Totals</h4>
<?php
if(!isset($_SESSION['USER_LOGIN'])){
if($total_subtotal>0){
?>
<table>
<tr>
<td>
<h6>Subtotal</h6>
</td>
<td>
<h6>₹<?php echo $total_subtotal; ?></h6>
</td>
</tr>
</table>
<div class="cktout">
<button onclick="control.redirect('checkout.php')">Proceed To Checkout</button>
</div>
<?php
}}else{
$utm=$_SESSION['utm_source'];
$uid=$_SESSION['USER_ID'];
$rs=mysqli_query($con,"select * from cart where u_id='$uid' and belonging_city='$utm'");
if(mysqli_num_rows($rs)>0){
$ct=mysqli_fetch_assoc($rs);
if($ct['total']>0){
?>
<table>
<tr>
<td>
<h6>Subtotal</h6>
</td>
<td>
<h6>₹<?php echo $ct['total']; ?></h6>
</td>
</tr>
<tr>
<td>
<h6>Shipping</h6>
</td>
<td>
<h6>₹
<?php
echo $ct['ship_fee'];
?></h6>
</td>
</tr>
<?php
if($ct['is_applied']){
?>
<tr>
<td>
<h6>Promo</h6>
</td>
<td>
<h6>-₹
<?php
echo $ct['promo'];
?></h6>
</td>
</tr>
<?php }
if($ct['is_add_w']){
?>
<tr>
<td>
<h6>From Wallet</h6>
</td>
<td>
<h6>-₹
<?php
echo $ct['wl_amt'];
?></h6>
</td>
</tr>
<?php
}
?>
<tr>
<td>
<h6>Grand Total</h6>
</td>
<td>
<h6>₹<?php echo $ct['final_amt']; ?></h6>
</td>
</tr>
</table>
<div class="cktout">
<button onclick="control.redirect('checkout.php')">Proceed To Checkout</button>
</div>
<?php
}
?>
<?php }}
?>
</div>
</div>
</div>
</section>
</section>
<?php require('require/foot.php'); ?>
<?php require('require/last.php'); ?>