-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheckout.php
More file actions
573 lines (490 loc) · 18 KB
/
checkout.php
File metadata and controls
573 lines (490 loc) · 18 KB
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
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
<!DOCTYPE html>
<html lang="en">
<?php
session_start();
?>
<head>
<!-- Basic -->
<meta charset="utf-8">
<title>Campus Online</title>
<meta name="keywords" content="WebSite Template" />
<meta name="description" content="Porto - Multipurpose Website Template">
<meta name="author" content="okler.net">
<!-- Favicon -->
<link rel="shortcut icon" href="img/favicon.ico" type="image/x-icon" />
<link rel="apple-touch-icon" href="img/apple-touch-icon.png">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1.0, shrink-to-fit=no">
<!-- Web Fonts -->
<link id="googleFonts"
href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800%7CShadows+Into+Light%7CPlayfair+Display:400&display=swap"
rel="stylesheet" type="text/css">
<!-- Vendor CSS -->
<link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="vendor/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="vendor/animate/animate.compat.css">
<link rel="stylesheet" href="vendor/simple-line-icons/css/simple-line-icons.min.css">
<link rel="stylesheet" href="vendor/owl.carousel/assets/owl.carousel.min.css">
<link rel="stylesheet" href="vendor/owl.carousel/assets/owl.theme.default.min.css">
<link rel="stylesheet" href="vendor/magnific-popup/magnific-popup.min.css">
<link rel="stylesheet" href="vendor/bootstrap-star-rating/css/star-rating.min.css">
<link rel="stylesheet" href="vendor/bootstrap-star-rating/themes/krajee-fas/theme.min.css">
<!-- Theme CSS -->
<link rel="stylesheet" href="css/theme.css">
<link rel="stylesheet" href="css/theme-elements.css">
<link rel="stylesheet" href="css/theme-blog.css">
<link rel="stylesheet" href="css/theme-shop.css">
<!-- Skin CSS -->
<link id="skinCSS" rel="stylesheet" href="css/skins/default.css">
<!-- Theme Custom CSS -->
<link rel="stylesheet" href="css/custom.css">
<!-- latest css -->
<link rel="stylesheet" href="css/latest.css">
<style>
body::after {
content: "";
display: table;
clear: both;
background-color: lightgreen;
}
.left-section {
float: left;
width: 40%;
/* Takes up 1/3 of the available space */
box-sizing: border-box;
}
.left-section-top {
background-color: white;
color: black;
text-align: center;
padding: 20px;
margin: 5px;
min-height: 40px;
max-height: 70px;
line-height: 70px;
/* Set line-height equal to max-height to vertically center text */
display: flex;
align-items: center;
justify-content: center;
border-radius: 5px;
margin-left: 30px;
}
.left-section-top img {
vertical-align: middle;
/* Vertically center the image */
/* Adjust margin as needed */
margin-left: -70px;
/* Adjust margin as needed to move the image slightly to the left */
}
.left-section-top h4 {
margin: 0;
color: black;
/* Remove default margin for h1 */
}
.left-section-bottom {
background-color: white;
color: white;
text-align: center;
padding: 20px;
margin: 5px;
min-height: 450px;
border-radius: 5px;
margin-left: 30px;
}
.right-section {
float: left;
width: 60%;
/* Takes up 2/3 of the available space */
box-sizing: border-box;
}
.right-section-inner {
background-color: white;
/* Adjust the color as needed */
color: black;
/* Set the text color to be visible */
text-align: center;
/* Center the text horizontally */
padding: 20px;
margin: 5px;
margin-right: 20px;
border-radius: 5px;
margin-bottom: 20px;
min-height: 565px;
}
.profile-menu {
list-style: none;
padding: 10px;
margin: 20px;
margin-right: 30px;
}
.profile-menu li {
margin-bottom: 20px;
margin-top: 20px;
}
.profile-menu a {
text-decoration: none !important;
/* Added !important */
color: #0088cc;
display: flex;
/* Use flex to align icon and text horizontally */
align-items: center;
/* Center items vertically */
padding: 10px;
border-radius: 5px;
transition: background-color 0.3s;
font-size: larger;
}
.profile-menu a svg {
margin-right: 10px;
/* Add margin to separate icon from text */
}
.profile-menu a:hover {
background-color: #0088cc;
color: white;
text-decoration: none !important;
/* Added !important */
}
</style>
</head>
<?php
// Retrieve the total sale price from the form submission
$totalSalePrice = $_GET['totalSalePrice'];
$productid = $_GET['productid'];
// Output the total sale price
?>
<body data-plugin-page-transition>
<?php include 'header.php'; ?>
<div class="body">
<div class="left-section">
<?php
// Start or resume the session
// Include the file to establish a database connection
include 'connect.php';
// Check if the session variable 'reg_no' is set
if (isset($_SESSION['idnum'])) {
// Sanitize the session variable to prevent SQL injection
$reg_no = mysqli_real_escape_string($conn, $_SESSION['idnum']);
// Fetch data from the users table based on the session variable 'reg_no'
$sql = "SELECT * FROM users WHERE reg_no = '$reg_no'";
// Execute the query
$result = mysqli_query($conn, $sql);
// Check if there are any results
if (mysqli_num_rows($result) > 0) {
// Output data of the user
while ($row = mysqli_fetch_assoc($result)) {
// Extract the first name from the user's name
$fullName = explode(" ", $row['firstname']);
$firstName = $fullName[0];
?>
<div class="left-section-top">
<a href="img/12.png"> <img src="img/12.png" alt="12" width="100" height="100"> </a>
Hello
<h4> <?php echo $firstName; ?></h4>
</div>
<?php
}
} else {
// If there are no results, display a message or take any other appropriate action
echo "No user found.";
}
} else {
// If the session variable 'reg_no' is not set, display a message or redirect to login page
echo "Session variable 'reg_no' not set.";
}
// Close the database connection
mysqli_close($conn);
?>
<div class="left-section-bottom">
<div class="col-lg-4 position-relative">
<div class="card border-width-3 border-radius-0 border-color-hover-dark"
style="min-height: 450px; min-width: 410px;">
<div class="card-body">
<h4 class="font-weight-bold text-uppercase text-4 mb-3">Your Order</h4>
<table class="shop_table cart-totals mb-3">
<tbody>
<!-- <tr>
<td colspan="2" class="border-top-0">
<strong class="text-color-dark">Product</strong>
</td>
</tr>
<tr>
<td>
<strong class="d-block text-color-dark line-height-1 font-weight-semibold">Black Porto Smartwatch <span class="product-qty">x1</span></strong>
<span class="text-1">COLOR BLACK</span>
</td>
<td class="text-end align-top">
<span class="amount font-weight-medium text-color-grey">$15</span>
</td>
</tr>
<tr>
<td class="border-top-0 pt-0">
<strong class="d-block text-color-dark line-height-1 font-weight-semibold">Black Porto Smartwatch <span class="product-qty">x1</span></strong>
<span class="text-1">COLOR BLACK</span>
</td>
<td class="border-top-0 text-end align-top pt-0">
<span class="amount font-weight-medium text-color-grey">$15</span>
</td>
</tr>
<tr class="cart-subtotal">
<td class="border-top-0">
<strong class="text-color-dark">Subtotal</strong>
</td>
<td class="border-top-0 text-end">
<strong><span class="amount font-weight-medium">$431</span></strong>
</td>
</tr> -->
<!-- <tr class="shipping">
<td colspan="2">
<strong class="d-block text-color-dark mb-2">Shipping</strong>
<div class="d-flex flex-column">
<label class="d-flex align-items-center text-color-grey mb-0" for="shipping_method1">
<input id="shipping_method1" type="radio" class="me-2" name="shipping_method" value="free" checked />
Free Shipping
</label>
<label class="d-flex align-items-center text-color-grey mb-0" for="shipping_method2">
<input id="shipping_method2" type="radio" class="me-2" name="shipping_method" value="local-pickup" />
Local Pickup
</label>
<label class="d-flex align-items-center text-color-grey mb-0" for="shipping_method3">
<input id="shipping_method3" type="radio" class="me-2" name="shipping_method" value="flat-rate" />
Flat Rate: $5.00
</label>
</div>
</td>
</tr> -->
<tr class="total">
<td>
<strong class="text-color-dark text-3-5">Total</strong>
</td>
<td class="text-end">
<strong class="text-color-dark"><span
class="amount text-color-dark text-5">₹
<?php echo $totalSalePrice; ?>
</span></strong>
</td>
</tr>
<!-- <tr class="payment-methods">
<td colspan="2">
<strong class="d-block text-color-dark mb-2">Payment Methods</strong>
<div class="d-flex flex-column">
<label class="d-flex align-items-center text-color-grey mb-0" for="payment_method1">
<input id="payment_method1" type="radio" class="me-2" name="payment_method" value="cash-on-delivery" checked />
Cash On Delivery
</label>
<label class="d-flex align-items-center text-color-grey mb-0" for="payment_method2">
<input id="payment_method2" type="radio" class="me-2" name="payment_method" value="paypal" />
PayPal
</label>
</div>
</td>
</tr> -->
<tr>
<td colspan="2">
Your personal data will be used to process your order, support your
experience throughout this website, and for other purposes described in our
privacy policy.
</td>
</tr>
</tbody>
</table>
<a <?php $total = $totalSalePrice; ?>
class="btn btn-dark btn-modern w-100 text-uppercase bg-color-hover-primary border-color-hover-primary border-radius-0 text-3 py-3 paynow">Place
Order <i class="fas fa-arrow-right ms-2"></i></a>
</div>
</div>
</div>
</div>
</div>
<?php
// Include your connect.php file
include('connect.php');
// Assuming $_SESSION['idnum'] contains the registration number
$idnum = $_SESSION['idnum'];
$query = "SELECT *
FROM users
WHERE users.reg_no = '$idnum'";
$result = $conn->query($query);
$row = $result->fetch_assoc();
// Assuming these fields exist in the result
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$reg_no = $row['reg_no'];
$email = $row['email'];
$phonenumber = $row['phonenumber']; // Get phone number from the joined result
$conn->close();
?>
<div class="right-section">
<div class="right-section-inner">
<div role="main" class="main shop pb-4">
<form role="form" class="needs-validation" method="post" action="">
<div class="row" style="width: 700px;">
<div class="col-lg-7 mb-4 mb-lg-0" style="width: 680px;">
<h2 class="text-color-dark font-weight-bold text-5-5 mb-3">Billing Details</h2>
<div class="row">
<div class="form-group col-md-6">
<label class="form-label" style="text-align: left !important;">First Name <span
class="text-color-danger">*</span></label>
<input type="text" class="form-control h-auto py-2" name="firstName"
value="<?php echo $firstname; ?>" readonly />
</div>
<div class="form-group col-md-6">
<label class="form-label">Last Name <span
class="text-color-danger">*</span></label>
<input type="text" class="form-control h-auto py-2" name="lastName"
value="<?php echo $lastname; ?>" readonly />
</div>
</div>
<div class="row">
<div class="form-group col">
<label class="form-label">Registration number<span
class="text-color-danger">*</span></label>
<input type="text" class="form-control h-auto py-2" name="companyName"
value="<?php echo $reg_no; ?>" readonly />
</div>
</div>
<div class="row">
<div class="form-group col">
<label class="form-label">Phone <span class="text-color-danger">*</span></label>
<input type="number" class="form-control h-auto py-2" name="phone"
value="<?php echo $phonenumber; ?>" readonly />
</div>
</div>
<div class="row">
<div class="form-group col">
<label class="form-label">Email Address <span
class="text-color-danger">*</span></label>
<input type="email" class="form-control h-auto py-2" name="email"
value="<?php echo $email; ?>" readonly />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="row" >
<div class="col" style="background-color: white; padding:10px; margin:35px; margin-top:-5px;">
<h4 class="font-weight-semibold text-4 mb-3" style="margin-left: 30px;">PEOPLE ALSO BOUGHT</h4>
<hr class="mt-0">
<div class="products row">
<div class="col">
<div class="row products product-thumb-info-list" data-plugin-masonry data-plugin-options="{'layoutMode': 'fitRows'}">
<?php
// Include the file to establish a database connection
include 'connect.php';
// Write your SQL query
$sql = "SELECT * FROM seller";
// Execute the query
$result = mysqli_query($conn, $sql);
// Check if there are any results
if (mysqli_num_rows($result) > 0) {
// Output data of each row
while ($row = mysqli_fetch_assoc($result)) {
// Output the HTML structure with product details
?>
<div class="col-12 col-sm-6 col-lg-3">
<br>
<div class="product mb-0">
<div class="product-thumb-info border-0 mb-3">
<div class="addtocart-btn-wrapper">
<a href="#" class="text-decoration-none addtocart-btn" title="Add to Cart" data-product-id="<?php echo $row['productid']; ?>">
<i class="icons icon-bag"></i>
</a>
</div>
<a href="product.php?productid=<?php echo $row['productid']; ?>">
<div class="product-thumb-info-image">
<img alt="" class="img-fluid" src="<?php echo $row['image']; ?>">
</div>
</a>
<a href="product.php?productid=<?php echo $row['productid']; ?>" class=" text-uppercase font-weight-semibold text-2">
QUICK VIEW
</a>
</div>
<div class="d-flex justify-content-between">
<div>
<a href="#" class="d-block text-uppercase text-decoration-none text-color-default text-color-hover-primary line-height-1 text-0 mb-1"><?php echo $row['Category']; ?></a>
<h3 class="text-3-5 font-weight-medium font-alternative text-transform-none line-height-3 mb-0"><a href="#" class="text-color-dark text-color-hover-primary"><?php echo $row['productName']; ?></a></h3>
</div>
<a href="#" class="text-decoration-none text-color-default text-color-hover-dark text-4 heart-icon" data-product-id="<?php echo $row['productid']; ?>"><i class="far fa-heart"></i></a>
</div>
<p class="price text-5 mb-3">
<span class="sale text-color-dark font-weight-semi-bold">₹<?php echo $row['salePrice']; ?></span>
<span class="amount">₹<?php echo $row['regularPrice']; ?></span>
</p>
</div>
</div>
<?php
}
} else {
echo "0 results";
}
// Close the database connection
mysqli_close($conn);
?>
</div>
</div>
<!-- Vendor -->
<script src="vendor/plugins/js/plugins.min.js"></script>
<script src="vendor/bootstrap-star-rating/js/star-rating.min.js"></script>
<script src="vendor/bootstrap-star-rating/themes/krajee-fas/theme.min.js"></script>
<script src="vendor/jquery.countdown/jquery.countdown.min.js"></script>
<!-- Theme Base, Components and Settings -->
<script src="js/theme.js"></script>
<!-- Current Page Vendor and Views -->
<script src="js/views/view.shop.js"></script>
<!-- Theme Custom -->
<script src="js/custom.js"></script>
<!-- Theme Initialization Files -->
<script src="js/theme.init.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
<script>
$(document).ready(function () {
$(".paynow").click(function (e) {
e.preventDefault(); // Prevent default behavior of anchor tag click
var amount = <?php echo $total; ?>;
var productid = <?php echo $productid; ?>;
var productname = "campus Ecommerce";// Assuming this variable is defined elsewhere in your code
var options = {
"key": "rzp_live_2D4bAGktbYxm16",
"amount": amount * 100,
"name": "Campus Online",
"description": productname,
"image": "http://localhost/hackathon/img/Campus.png",
"handler": function (response) {
var paymentid = response.razorpay_payment_id;
$.ajax({
url: "payment-process.php",
type: "POST",
data: { product_id: productid, payment_id: paymentid }, // Replace 'your_product_id' with the actual product ID
success: function (finalresponse) {
if (finalresponse == 'done') {
window.location.href = "http://localhost/hackathon/cartbill.php";
} else {
alert('Please check console.log to find error');
console.log(finalresponse);
}
}
});
},
"theme": {
"color": "#3399cc"
}
};
var rzp1 = new Razorpay(options);
rzp1.open();
});
});
</script>
<!--
// Assuming you have a variable selectedProductCount that represents the count
const selectedProductCount = 1;
// Update the count badge text
document.querySelector('.count-badge').textContent = selectedProductCount.toString(); -->
</div>
</div>
<?php include 'footer.php'; ?>
</body>
</html>