-
Notifications
You must be signed in to change notification settings - Fork 0
/
userprofile copy.php
431 lines (268 loc) · 14.7 KB
/
userprofile copy.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
<?php
session_start();
include_once("admin/class/adminback.php");
$obj = new adminback();
$cata_info = $obj->p_display_catagory();
$cataDatas = array();
while ($data = mysqli_fetch_assoc($cata_info)) {
$cataDatas[] = $data;
}
// if (isset($_POST['user_login_btn'])) {
// $logmsg = $obj->user_login($_POST);
// }
$userid = $_SESSION['user_id'];
$username = $_SESSION['username'];
if (empty($userid)) {
header("location:user_login.php");
}
if(empty($_SESSION['cart'])){
header("location:exist_order.php");
}
if (isset($_POST['remove_product'])) {
foreach ($_SESSION['cart'] as $key => $value) {
if ($value['pdt_name'] == $_POST['remove_pdt_name']) {
unset($_SESSION['cart'][$key]);
$_SESSION['cart'] = array_values($_SESSION['cart']);
}
}
}
if (isset($_GET['logout'])) {
if ($_GET['logout'] == "logout") {
$obj->user_logout();
}
}
if (isset($_POST['confirm_order'])) {
$obj->place_order($_POST);
}
?>
<?php
include_once("includes/head.php");
?>
<body class="biolife-body">
<!-- Preloader -->
<?php
include_once("includes/preloader.php");
?>
<!-- HEADER -->
<header id="header" class="header-area style-01 layout-03">
<?php
include_once("includes/header_top.php");
?>
<?php
include_once("includes/header_middle.php");
?>
<?php
include_once("includes/header_bottom.php");
?>
</header>
<!-- Page Contain -->
<div class="page-contain">
<!-- Main content -->
<div id="main-content" class="main-content">
<div class="container">
<div class="row">
<div class="col-md-2">
<h4>Hello <?php
if (isset($username)) {
echo strtoupper($username);
}
?></h4>
<a href="?logout=logout">Logout</a>
</div>
<div class="col-md-7">
<h2 class="text-center text-dark">Order Sumary</h2>
<?php
if (isset($_SESSION['cart'])) {
if (count($_SESSION['cart']) > 0) {
?>
<table class="shop_table cart-form">
<thead>
<tr>
<th class="product-name">Product Name</th>
<th class="product-name">Price</th>
<th class="product-price">Quantity</th>
<th class="product-quantity">Remove</th>
<th class="product-subtotal">Total</th>
</tr>
</thead>
<tbody>
<?php if (isset($_SESSION['cart'])) {
$_SESSION['subtotal'] = 0;
$_SESSION['cart_pdt_number'] = 0;
$order_names = '';
foreach ($_SESSION['cart'] as $key => $value) {
$_SESSION['subtotal'] = $_SESSION['subtotal'] + $value['pdt_price'];
$_SESSION['cart_pdt_number']++;
$order_names = $value['pdt_name'] . "<br> " . $order_names;
?>
<tr class="cart_item">
<td class="product-thumbnail" data-title="Product Name">
<a class="prd-thumb" href="single_product.php?status=singleproduct&&id=<?php echo $value['pdt_id'] ?>">
<figure><img width="113" height="113" src="admin/uploads/<?php echo $value['pdt_img'] ?>" alt="shipping cart"></figure>
</a>
<a class="prd-name" href="single_product.php?status=singleproduct&&id=<?php echo $value['pdt_id'] ?>"><?php echo $value['pdt_name'] ?></a>
</td>
<td class="product-subtotal" data-title="Total">
<div class="price price-contain">
<ins><span class="price-amount"><?php echo $value['pdt_price'] ?>
<input type="hidden" class="pdt_price" value="<?php echo $value['pdt_price'] ?>">
</span></ins>
</div>
</td>
<td class="product-quantity" data-title="Quantity">
<form action="" method="POST">
<input class="btn btn-warning" type="submit" value="Remove" name="remove_product">
<input type="hidden" value="<?php echo $value['pdt_name'] ?>" name="remove_pdt_name">
</form>
</td>
<form class="shopping-cart-form" action="#" method="POST">
<td class="product-price" data-title="Price">
<div class="">
<input type="number" value="1" name="quantity[]" class="quantity" style="width: 65px;" min="1" max="10" onchange="subtotal(), totalOfAll()">
</div>
</td>
<td class="product-subtotal" data-title="Total">
<div class="price price-contain">
<ins><span class="price-amount subtotal"> <?php echo $value['pdt_price'] ?> </span></ins>
</div>
</td>
</tr>
<?php }
} else {
echo "Your cart is empty";
} ?>
<!-- <tr class="cart_item wrap-buttons">
<td>
<h3 style="color: black;">Payment</h3>
</td>
<form class="shopping-cart-form" action="#" method="POST">
<td colspan="3">
<input type="text" style="border: none; width:100%;" placeholder="input bKash TXID" name="txid" required>
</td>
</tr> -->
<!-- <tr class="cart_item wrap-buttons">
<td>
<h3 style="color: black;">Shiping Address</h3>
</td>
<td colspan="3">
<input type="text" style="border: none; width:100%" placeholder="input courier service and location" name="shiping" required>
</td>
</tr> -->
</tbody>
</table>
<input type="hidden" name="user_id" value="<?php echo $_SESSION['user_id'] ?>">
<input type="hidden" name="product_name" value="<?php echo $order_names ?>">
<input type="hidden" name="product_item" value="<?php echo $_SESSION['cart_pdt_number'] ?>">
<input type="hidden" name="amount" value="<?php echo $_SESSION['subtotal'] ?>">
<input type="hidden" name="order_status" value="0">
<?php
} else {
echo "your cart is empty";
}
}
?>
</div>
<div class="col-md-3">
<div class="shpcart-subtotal-block">
<div class="subtotal-line">
<b class="stt-name">Subtotal <span class="sub">(<?php echo $_SESSION['cart_pdt_number'] ?> Items)</span></b>
<span class="stt-price" id="totalOfall"> <?php echo $_SESSION['subtotal'] ?> </span>
</div>
<div class="subtotal-line ">
<p class="stt-name" style="font-weight: normal;">Use Cupon (fruitsbazar)</p>
<br>
<input type="text" id="cupon" class="form-control" style="width:40%; padding:5px; display:inline">
<span class="stt-price" style="font-weight: normal;" id="discount"></span>
</div>
<hr style="border-top:1px solid #313030">
<div class="subtotal-line">
<b class="stt-name" style="font-weight: normal;">Total</b>
<span class="stt-price" style="font-weight: normal;" id="afterdiscount"></span>
</div>
<div style="margin-top: 25px;">
<b class="stt-name">Payment <span class="sub"></span></b>
<input type="text" style="border: none; width:100%;" placeholder="input bKash TXID" name="txid" required>
</div>
<div style="margin-top: 25px;">
<b class="stt-name">Mobile <span class="sub"></span></b> <br>
<input type="text" name="shipping_Mobile" class="form-control" value="<?php echo $_SESSION['mobile'] ?>" required>
</div>
<div style="margin-top: 25px;">
<b class="stt-name">Shipping Address <span class="sub"></span></b> <br>
<textarea name="shiping" class="form-control" id="" required> <?php echo $_SESSION['address'] ?> </textarea>
</div>
<div class="subtotal-line">
<b class="stt-name"></b>
<span class="stt-price" id="priceWithVat"></span>
</div>
<div class="btn-checkout">
<input type="submit" class="btn btn-success btn-block btn-lg " value="Confirm Order" name="confirm_order">
</div>
</form>
<p class="pickup-info"><b>Free Pickup</b> is available as soon as today More about shipping and pickup</p>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<script>
var item_price = document.getElementsByClassName("pdt_price");
var item_quantity = document.getElementsByClassName("quantity");
var item_total = document.getElementsByClassName("subtotal");
function subtotal() {
for (let i = 0; i < item_price.length; i++) {
item_total[i].innerText = item_price[i].value * item_quantity[i].value;
}
}
var totalAll = document.getElementById("totalOfall");
function totalOfAll() {
let total = 0;
for (let i = 0; i < item_total.length; i++) {
total += parseInt(item_total[i].innerText);
}
totalAll.innerText = total;
}
$(document).ready(function() {
var cupon_code = $("#cupon");
var discount = $("#discount");
var total_price = parseInt($("#totalOfall").text());
$("#afterdiscount").text(total_price);
$(cupon_code).on("keyup keydown keypress blur", function() {
// alert (cupon_code.val());
$.ajax({
url: "json/coupon.php",
method: "POST",
data: {
action: 'load_discount',
cupon: cupon_code.val(),
price: total_price
},
success: function(data) {
var html = Math.round(data);
discount.text(html);
}
})
$("#afterdiscount").text(total_price - parseInt(discount.text()));
})
})
</script>
<!-- FOOTER -->
<?php
include_once("includes/footer.php");
?>
<!--Footer For Mobile-->
<?php
include_once("includes/mobile_footer.php");
?>
<?php
include_once("includes/mobile_global.php")
?>
<!-- Scroll Top Button -->
<a class="btn-scroll-top"><i class="biolife-icon icon-left-arrow"></i></a>
<?php
include_once("includes/script.php")
?>
</body>
</html>