-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout.php
342 lines (285 loc) · 16.4 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
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
<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache");
header("Expires: 0");
?>
<?php require_once("resources/config.php"); ?>
<?php require_once(TEMPLATE_FRONT.DS."header.php"); ?>
<!--header ENDS-->
<?php
if(!isset($_SESSION['user_id'])){
redirect("login.php");
die();
}else{
$user_id = $_SESSION['user_id'];
}
//To check if user has any pre saved addresses or not
$address_query = query("SELECT * FROM address WHERE user_id = {$user_id}");
confirm($address_query);
if(rows($address_query)== '0'){
$address_found = '1';
}else{
$address_found = '0';
}
?>
<div class='container'> <!--Container start-->
<div class='row'> <!--Row start-->
<div class='col-md-12'> <!--main column start-->
<h2 class="text-danger bg-danger text-center"><?php display_message();?></h2>
<div id='mainContentWrapper'> <!--main content wrapper start-->
<div class="col-md-8 col-md-offset-2"> <!--col-md-8 start-->
<h2 class="text-center well">
Review Your Order & Complete Checkout
</h2>
<hr/>
<a href="ombre.php" class="btn btn-info btn-block">Add More Products</a>
<a href="cart-items.php" class="btn btn-danger btn-block">Back to cart</a>
<hr/ style="margin-top: 10px;">
<div class="shopping_cart"> <!--shopping cart div start-->
<form class="form-horizontal" role="form" action="resources\paytm\process_payment.php" method="POST" id="payment-form" onsubmit="return validateCheckoutForm()">
<div class="panel-group" id="accordion"> <!--panel group start-->
<div class="panel panel-default"> <!--1st panel start-->
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Review Your Order
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in"> <!--collapseOne start-->
<div class="panel-body"> <!--2nd Panel body start-->
<div class="items"> <!--items start-->
<?php display_products_in_checkout();
if(isset($_SESSION['checkout_total_items'])){
if($_SESSION['checkout_total_items'] == 0){
set_message('Please add some items in your cart!');
redirect("cart-items.php");
die();
}
}
?>
<div class="col-md-9">
<table class="table table-striped table-responsive text-right table-bordered">
<tr>
<th colspan="3">
<h4>PRICE DETAILS</h4>
</th>
</tr>
<tr>
<th>Price(<?php
if(isset($_SESSION['checkout_total_items'])){
if($_SESSION['checkout_total_items'] == 1){
echo $_SESSION['checkout_total_items']." item";
}else{
echo $_SESSION['checkout_total_items']." items";
}
}
?>)</th>
<td>Rs. <?php
if(isset($_SESSION['checkout_total'])){
echo $_SESSION['checkout_total'];
}
?></td>
</tr>
<tr>
<th>Delivery</th>
<td class="text-success">Free</td>
</tr>
<tr>
<th>Amount Payable</th>
<th class="text-right">Rs. <?php
if(isset($_SESSION['checkout_total'])){
echo $_SESSION['checkout_total'];
}
?></th>
</tr>
</table>
</div>
</div> <!--items end-->
</div> <!-- 1st Panel body end-->
<div class="panel-footer panelFooterOne">
<button
data-toggle="collapse"
data-parent="#accordion"
data-target="#collapseTwo"
type="button"
class=" btn btn-success btn-block text-center"
>
Continue to Billing Information»
</button>
</div>
</div> <!--collapseOne end-->
</div> <!--1st panel end-->
<div class="panel panel-default"> <!--2nd panel start-->
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Contact and Billing Information
</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse"> <!-- collapseTwo start -->
<div class="panel-body"> <!-- 2nd panel body start -->
<div class="items">
<div class="col-md-12">
<div class="address_not_found_div hide">
<h4 class="well text-primary">Sorry you don't have any address saved!</h4>
</div>
<?php
get_user_address();
?>
</div>
<div class="col-md-12 update_address_div row">
<button class="btn btn-info add_address_btn" type="button"><span class="fa fa-plus"></span> Add New Address</button>
</div>
</div><!-- items end-->
</div> <!-- 2nd panel body end -->
<div class="panel-footer">
<button
data-toggle="collapse"
data-parent="#accordion"
data-target="#collapseThree"
type="button"
class=" btn btn-success btn-block text-center"
>
Enter Payment Information »
</button>
</div>
</div> <!-- collapseTwo end -->
</div> <!--2nd panel end-->
<div class="panel panel-default"> <!-- 3rd panel start-->
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Payment Information
</a>
</h4>
</div>
<div id="collapseThree" class="panel-collapse collapse"> <!-- collapseThree start -->
<div class="panel-body"> <!--3rd panel body start-->
<div class="col-md-12 payment_div">
<h5 class="well text-primary">Credit Card/Debit Card/NetBanking/Paytm Wallet/Cash On Delivery</h5>
<div class="col-md-7 paytm_div">
<lable for="paytm"><img src="resources/uploads/paytm.png" alt="pay with paytm" class="img-responsive paytm-img"></label>
<input type="radio" class="" name="payment_option" value="pay_with_paytm" id="paytm">
</div>
<div class="col-md-5 cod_div">
<label for="cod">Cash On Delivery</label>
<input type="radio" class="" name="payment_option" value="cod" id="cod">
</div>
</div>
</div> <!--3rd panel body end-->
<div class="panel-footer">
<button
type="submit"
name="submit"
class=" btn btn-success btn-block text-center"
>
Proceed »
</button>
</div>
</div> <!-- collapseThree end -->
</div> <!-- 3rd panel end-->
</div> <!--panel group start-->
</form>
</div> <!--shopping cart div end-->
</div> <!--col-md-8 end-->
</div> <!--main content wrapper end-->
</div> <!--main column end-->
</div> <!--Row end-->
</div> <!--Container end-->
<!-- Modal 1 -->
<div id="errorModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body bg-danger text-danger">
<button type="button" class="close" data-dismiss="modal">×</button>
<strong><p id="error_text"></p></strong>
</div>
</div>
</div>
</div>
<!-- Modal 2 Edit address modal -->
<div id="editAddressModal" class="modal fade" role="dialog">
<div class="modal-dialog"> <!-- modal dialog start -->
<!-- Modal content-->
<div class="modal-content" style="background-color:#f6f6f6;"> <!-- modal content start -->
<!--Modal Header-->
<div class="modal-header">
<h4 class="modal-title"></h4>
</div>
<div class="modal-body"> <!-- modal body start -->
<form id="editAddressForm" autocomplete="off" method="post" onclick="return validateEditAddressForm()" action="ajax_user_address_checkout.php">
<div class="row">
<div class="col-sm-12 form-group">
<label for="address">Address*</label>
<textarea placeholder="Enter Address Here.." rows="3" class="form-control" name="address" id="address"></textarea>
</div>
</div>
<div class="row">
<div class="col-sm-4 form-group">
<label for="city">City*</label>
<input type="text" placeholder="Enter City Name Here.." class="form-control" id="city" name="city">
</div>
<div class="col-sm-4 form-group">
<label for="state">State*</label>
<input type="text" placeholder="Enter State Name Here.." class="form-control" id="state" name="state">
</div>
<div class="col-sm-4 form-group">
<label for="zip">Zip*</label>
<input type="text" placeholder="Enter Zip Code Here.." class="form-control" name="zip" id="zip">
</div>
</div>
<div class="row">
<div class="col-sm-12 form-group numberdiv">
<label for="number">Phone Number*</label>
<input type="text" placeholder="Can be same as registered mobile number.." class="form-control" id="number" name="number">
</div>
</div>
<input type="text" hidden="hidden" name="" id="general_address_id">
<button type="submit" class="btn btn-info" title=""><span class="fa"></span></button>
<button type="button" class="btn btn-danger" data-dismiss="modal" title="Cancel"><span class="fa fa-remove"></span> Cancel</button>
</form>
</div> <!-- modal body end -->
</div> <!-- modal content end -->
</div> <!-- modal dialog end -->
</div>
<!--Modal 3 for error report of check out validation -->
<div id="validateErrorModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-body bg-danger text-danger">
<button type="button" class="close" data-dismiss="modal">×</button>
<strong><p id="checkout_error_text"></p></strong>
</div>
</div>
</div>
</div>
<!-- Modal 4 for confirmation of 10 minutes warning -->
<!--<div id="confirm" class="modal fade" role="dialog">
<div class="modal-dialog">
<! Modal content>
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Attention</h4>
</div>
<div class="modal-body">
You will given 10 minutes for completing this transaction after
that this product will be displayed to other users also and product may or may not be available!
</div>
<!Modal Footer >
<div class="modal-footer">
<button type="button" class="btn btn-primary" id="confirm-btn">Confirm</button>
<button type="button" data-dismiss="modal" class="btn" id="cancel">Cancel</button>
</div>
</div>
</div>
</div>-->
<!-- FOOTER -->
<?php require_once(TEMPLATE_FRONT.DS."footer.php"); ?>
<script>
var address_found = '<?php echo $address_found;?>';
</script>
<script src="bootstrap/dist/js/checkout.js"></script>