-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout.php
246 lines (226 loc) · 12.6 KB
/
checkout.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
<?php
session_start();
include("connection.inc.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>EShopper - Bootstrap Shop Template</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Free HTML Templates" name="keywords">
<meta content="Free HTML Templates" name="description">
<!-- Favicon -->
<link href="img/favicon.ico" rel="icon">
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.10.0/css/all.min.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<!-- Customized Bootstrap Stylesheet -->
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<!-- Topbar Start -->
<?php
require("header.php");
?>
<!-- Navbar Start -->
<?php
require("navbar.php");
?>
<!-- Topbar End -->
<!-- Page Header Start -->
<div class="container-fluid bg-secondary mb-5">
<div class="d-flex flex-column align-items-center justify-content-center" style="min-height: 300px">
<h1 class="font-weight-semi-bold text-uppercase mb-3">Checkout</h1>
<div class="d-inline-flex">
<p class="m-0"><a href="">Home</a></p>
<p class="m-0 px-2">-</p>
<p class="m-0">Checkout</p>
</div>
</div>
</div>
<!-- Page Header End -->
<!-- Checkout Start -->
<form action="process_order.php" method="POST">
<div class="container-fluid pt-5">
<div class="row px-xl-5">
<div class="col-lg-8">
<div class="mb-4">
<h4 class="font-weight-semi-bold mb-4">Billing Address</h4>
<div class="row">
<div class="col-md-6 form-group">
<label>First Name</label>
<input class="form-control" type="text" name="first_name" placeholder="Rahul" required>
</div>
<div class="col-md-6 form-group">
<label>Last Name</label>
<input class="form-control" type="text" name="last_name" placeholder="Sharma" required>
</div>
<div class="col-md-6 form-group">
<label>E-mail</label>
<input class="form-control" type="email" name="email" placeholder="example@example.com" required>
</div>
<div class="col-md-6 form-group">
<label>Mobile No</label>
<input class="form-control" type="text" name="mobile_no" placeholder="+91 98765 43210" required>
</div>
<div class="col-md-6 form-group">
<label>Address Line 1</label>
<input class="form-control" type="text" name="address_line1" placeholder="123 MG Road" required>
</div>
<div class="col-md-6 form-group">
<label>Address Line 2</label>
<input class="form-control" type="text" name="address_line2" placeholder="Near XYZ Building">
</div>
<div class="col-md-6 form-group">
<label>Country</label>
<select class="custom-select" name="country" required>
<option value="India" selected>India</option>
</select>
</div>
<div class="col-md-6 form-group">
<label>City</label>
<input class="form-control" type="text" name="city" placeholder="Mumbai" required>
</div>
<div class="col-md-6 form-group">
<label>State</label>
<input class="form-control" type="text" name="state" placeholder="Maharashtra" required>
</div>
<div class="col-md-6 form-group">
<label>PIN Code</label>
<input class="form-control" type="text" name="pin_code" placeholder="400001" required>
</div>
<div class="col-md-12 form-group">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="shipto" data-toggle="collapse" data-target="#shipping-address">
<label class="custom-control-label" for="shipto">Ship to different address</label>
</div>
</div>
</div>
</div>
<div class="collapse mb-4" id="shipping-address">
<h4 class="font-weight-semi-bold mb-4">Shipping Address</h4>
<div class="row">
<div class="col-md-6 form-group">
<label>First Name</label>
<input class="form-control" type="text" name="shipping_first_name" placeholder="Rahul">
</div>
<div class="col-md-6 form-group">
<label>Last Name</label>
<input class="form-control" type="text" name="shipping_last_name" placeholder="Sharma">
</div>
<div class="col-md-6 form-group">
<label>E-mail</label>
<input class="form-control" type="email" name="shipping_email" placeholder="example@example.com">
</div>
<div class="col-md-6 form-group">
<label>Mobile No</label>
<input class="form-control" type="text" name="shipping_mobile_no" placeholder="+91 98765 43210">
</div>
<div class="col-md-6 form-group">
<label>Address Line 1</label>
<input class="form-control" type="text" name="shipping_address_line1" placeholder="123 MG Road">
</div>
<div class="col-md-6 form-group">
<label>Address Line 2</label>
<input class="form-control" type="text" name="shipping_address_line2" placeholder="Near XYZ Building">
</div>
<div class="col-md-6 form-group">
<label>Country</label>
<select class="custom-select" name="shipping_country">
<option value="India" selected>India</option>
</select>
</div>
<div class="col-md-6 form-group">
<label>City</label>
<input class="form-control" type="text" name="shipping_city" placeholder="Mumbai">
</div>
<div class="col-md-6 form-group">
<label>State</label>
<input class="form-control" type="text" name="shipping_state" placeholder="Maharashtra">
</div>
<div class="col-md-6 form-group">
<label>PIN Code</label>
<input class="form-control" type="text" name="shipping_pin_code" placeholder="400001">
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="card border-secondary mb-5">
<div class="card-header bg-secondary border-0">
<h4 class="font-weight-semi-bold m-0">Order Total</h4>
</div>
<div class="card-body">
<h5 class="font-weight-medium mb-3">Products</h5>
<?php
$subtotal = 0;
if(isset($_SESSION['cart'])){
foreach($_SESSION['cart'] as $key => $val){
$productArr = get_product($con, '', '', $key);
$pname = $productArr[0]['name'];
$price = $productArr[0]['price'];
$qty = $val['qty'];
$subtotal += $price * $qty;
?>
<!-- Product Entry -->
<div class="d-flex justify-content-between">
<p><?php echo $pname; ?></p>
<p>₹<?php echo $price; ?></p>
</div>
<?php
}
}
?>
<hr class="mt-0">
<div class="d-flex justify-content-between mb-3 pt-1">
<h6 class="font-weight-medium">Subtotal</h6>
<h5 class="font-weight-medium">₹<?php echo $subtotal; ?></h5>
</div>
<div class="d-flex justify-content-between">
<h6 class="font-weight-medium">Shipping</h6>
<h6 class="font-weight-medium">₹50</h6>
</div>
</div>
<div class="card-footer border-secondary bg-transparent">
<div class="d-flex justify-content-between mt-2">
<h5 class="font-weight-bold">Total</h5>
<h5 class="font-weight-bold">₹<?php echo $subtotal + 50; ?></h5>
</div>
</div>
</div>
<div class="card-footer border-secondary bg-transparent">
<div class="custom-control custom-radio">
<input type="radio" class="custom-control-input" name="payment_method" value="Cash on Delivery" id="cashondelivery" checked>
<label class="custom-control-label" for="cashondelivery">Cash on Delivery</label>
</div>
<button class="btn btn-lg btn-block btn-primary font-weight-bold my-3 py-3" type="submit" onclick="checkAndPlaceOrder()">Place Order</button>
</div>
</div>
</div>
</div>
</form>
<!-- Checkout End -->
<!-- Footer Start -->
<?php
require("footer.php");
?>
<!-- Footer End -->
<!-- Back to Top -->
<a href="#" class="btn btn-primary back-to-top"><i class="fa fa-angle-double-up"></i></a>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="lib/easing/easing.min.js"></script>
<script src="lib/owlcarousel/owl.carousel.min.js"></script>
<!-- Contact Javascript File -->
<script src="mail/jqBootstrapValidation.min.js"></script>
<script src="mail/contact.js"></script>
<!-- Template Javascript -->
<script src="js/main.js"></script>
</body>
</html>