-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkout.php
386 lines (347 loc) · 19.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
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
<?php require_once('header.php'); ?>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$banner_checkout = $row['banner_checkout'];
}
?>
<?php
if(!isset($_SESSION['cart_p_id'])) {
header('location: cart.php');
exit;
}
?>
<div class="page-banner" style="background-image: url(assets/uploads/<?php echo $banner_checkout; ?>)">
<div class="overlay"></div>
<div class="page-banner-inner">
<h1><?php echo LANG_VALUE_22; ?></h1>
</div>
</div>
<div class="page">
<div class="container">
<div class="row">
<div class="col-md-12">
<?php if(!isset($_SESSION['customer'])): ?>
<p>
<a href="login.php" class="btn btn-md btn-danger"><?php echo LANG_VALUE_160; ?></a>
</p>
<?php else: ?>
<h3 class="special"><?php echo LANG_VALUE_26; ?></h3>
<div class="cart">
<table class="table table-responsive table-hover table-bordered">
<tr>
<th><?php echo '#' ?></th>
<th><?php echo LANG_VALUE_8; ?></th>
<th><?php echo LANG_VALUE_47; ?></th>
<th><?php echo LANG_VALUE_157; ?></th>
<th><?php echo LANG_VALUE_158; ?></th>
<th><?php echo LANG_VALUE_159; ?></th>
<th><?php echo LANG_VALUE_55; ?></th>
<th class="text-right"><?php echo LANG_VALUE_82; ?></th>
</tr>
<?php
$table_total_price = 0;
$i=0;
foreach($_SESSION['cart_p_id'] as $key => $value)
{
$i++;
$arr_cart_p_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_size_id'] as $key => $value)
{
$i++;
$arr_cart_size_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_size_name'] as $key => $value)
{
$i++;
$arr_cart_size_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_color_id'] as $key => $value)
{
$i++;
$arr_cart_color_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_color_name'] as $key => $value)
{
$i++;
$arr_cart_color_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_qty'] as $key => $value)
{
$i++;
$arr_cart_p_qty[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_current_price'] as $key => $value)
{
$i++;
$arr_cart_p_current_price[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_name'] as $key => $value)
{
$i++;
$arr_cart_p_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_featured_photo'] as $key => $value)
{
$i++;
$arr_cart_p_featured_photo[$i] = $value;
}
?>
<?php for($i=1;$i<=count($arr_cart_p_id);$i++): ?>
<tr>
<td><?php echo $i; ?></td>
<td>
<img src="assets/uploads/<?php echo $arr_cart_p_featured_photo[$i]; ?>" alt="">
</td>
<td><?php echo $arr_cart_p_name[$i]; ?></td>
<td><?php echo $arr_cart_size_name[$i]; ?></td>
<td><?php echo $arr_cart_color_name[$i]; ?></td>
<td><?php echo LANG_VALUE_1; ?><?php echo $arr_cart_p_current_price[$i]; ?></td>
<td><?php echo $arr_cart_p_qty[$i]; ?></td>
<td class="text-right">
<?php
$row_total_price = $arr_cart_p_current_price[$i]*$arr_cart_p_qty[$i];
$table_total_price = $table_total_price + $row_total_price;
?>
<?php echo LANG_VALUE_1; ?><?php echo $row_total_price; ?>
</td>
</tr>
<?php endfor; ?>
<tr>
<th colspan="7" class="total-text"><?php echo LANG_VALUE_81; ?></th>
<th class="total-amount"><?php echo LANG_VALUE_1; ?><?php echo $table_total_price; ?></th>
</tr>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_shipping_cost WHERE country_id=?");
$statement->execute(array($_SESSION['customer']['cust_country']));
$total = $statement->rowCount();
if($total) {
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$shipping_cost = $row['amount'];
}
} else {
$statement = $pdo->prepare("SELECT * FROM tbl_shipping_cost_all WHERE sca_id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
$shipping_cost = $row['amount'];
}
}
?>
<tr>
<td colspan="7" class="total-text"><?php echo LANG_VALUE_84; ?></td>
<td class="total-amount"><?php echo LANG_VALUE_1; ?><?php echo $shipping_cost; ?></td>
</tr>
<tr>
<th colspan="7" class="total-text"><?php echo LANG_VALUE_82; ?></th>
<th class="total-amount">
<?php
$final_total = $table_total_price+$shipping_cost;
?>
<?php echo LANG_VALUE_1; ?><?php echo $final_total; ?>
</th>
</tr>
</table>
</div>
<div class="billing-address">
<div class="row">
<div class="col-md-6">
<h3 class="special"><?php echo LANG_VALUE_161; ?></h3>
<table class="table table-responsive table-bordered table-hover table-striped bill-address">
<tr>
<td><?php echo LANG_VALUE_102; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_name']; ?></p></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_103; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_cname']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_104; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_phone']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_106; ?></td>
<td>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_country WHERE country_id=?");
$statement->execute(array($_SESSION['customer']['cust_b_country']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
echo $row['country_name'];
}
?>
</td>
</tr>
<tr>
<td><?php echo LANG_VALUE_105; ?></td>
<td>
<?php echo nl2br($_SESSION['customer']['cust_b_address']); ?>
</td>
</tr>
<tr>
<td><?php echo LANG_VALUE_107; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_city']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_108; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_state']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_109; ?></td>
<td><?php echo $_SESSION['customer']['cust_b_zip']; ?></td>
</tr>
</table>
</div>
<div class="col-md-6">
<h3 class="special"><?php echo LANG_VALUE_162; ?></h3>
<table class="table table-responsive table-bordered table-hover table-striped bill-address">
<tr>
<td><?php echo LANG_VALUE_102; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_name']; ?></p></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_103; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_cname']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_104; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_phone']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_106; ?></td>
<td>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_country WHERE country_id=?");
$statement->execute(array($_SESSION['customer']['cust_s_country']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
echo $row['country_name'];
}
?>
</td>
</tr>
<tr>
<td><?php echo LANG_VALUE_105; ?></td>
<td>
<?php echo nl2br($_SESSION['customer']['cust_s_address']); ?>
</td>
</tr>
<tr>
<td><?php echo LANG_VALUE_107; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_city']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_108; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_state']; ?></td>
</tr>
<tr>
<td><?php echo LANG_VALUE_109; ?></td>
<td><?php echo $_SESSION['customer']['cust_s_zip']; ?></td>
</tr>
</table>
</div>
</div>
</div>
<div class="cart-buttons">
<ul>
<li><a href="cart.php" class="btn btn-primary"><?php echo LANG_VALUE_21; ?></a></li>
</ul>
</div>
<div class="clear"></div>
<h3 class="special"><?php echo LANG_VALUE_33; ?></h3>
<div class="row">
<?php
$checkout_access = 1;
if(
($_SESSION['customer']['cust_b_name']=='') ||
($_SESSION['customer']['cust_b_cname']=='') ||
($_SESSION['customer']['cust_b_phone']=='') ||
($_SESSION['customer']['cust_b_country']=='') ||
($_SESSION['customer']['cust_b_address']=='') ||
($_SESSION['customer']['cust_b_city']=='') ||
($_SESSION['customer']['cust_b_state']=='') ||
($_SESSION['customer']['cust_b_zip']=='') ||
($_SESSION['customer']['cust_s_name']=='') ||
($_SESSION['customer']['cust_s_cname']=='') ||
($_SESSION['customer']['cust_s_phone']=='') ||
($_SESSION['customer']['cust_s_country']=='') ||
($_SESSION['customer']['cust_s_address']=='') ||
($_SESSION['customer']['cust_s_city']=='') ||
($_SESSION['customer']['cust_s_state']=='') ||
($_SESSION['customer']['cust_s_zip']=='')
) {
$checkout_access = 0;
}
?>
<?php if($checkout_access == 0): ?>
<div class="col-md-12">
<div style="color:red;font-size:22px;margin-bottom:50px;">
You must have to fill up all the billing and shipping information from your dashboard panel in order to checkout the order. Please fill up the information going to <a href="customer-billing-shipping-update.php" style="color:red;text-decoration:underline;">this link</a>.
</div>
</div>
<?php else: ?>
<div class="col-md-4">
<div class="row">
<div class="col-md-12 form-group">
<label for=""><?php echo LANG_VALUE_34; ?> *</label>
<select name="payment_method" class="form-control select2" id="advFieldsStatus">
<option value=""><?php echo LANG_VALUE_35; ?></option>
<option value="PayPal"><?php echo LANG_VALUE_36; ?></option>
<option value="Bank Deposit"><?php echo LANG_VALUE_38; ?></option>
</select>
</div>
<form class="paypal" action="<?php echo BASE_URL; ?>payment/paypal/payment_process.php" method="post" id="paypal_form" target="_blank">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />
<input type="hidden" name="final_total" value="<?php echo $final_total; ?>">
<div class="col-md-12 form-group">
<input type="submit" class="btn btn-primary" value="<?php echo LANG_VALUE_46; ?>" name="form1">
</div>
</form>
<form action="payment/bank/init.php" method="post" id="bank_form">
<input type="hidden" name="amount" value="<?php echo $final_total; ?>">
<div class="col-md-12 form-group">
<label for=""><?php echo LANG_VALUE_43; ?></span></label><br>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
echo nl2br($row['bank_detail']);
}
?>
</div>
<div class="col-md-12 form-group">
<label for=""><?php echo LANG_VALUE_44; ?> <br><span style="font-size:12px;font-weight:normal;">(<?php echo LANG_VALUE_45; ?>)</span></label>
<textarea name="transaction_info" class="form-control" cols="30" rows="10"></textarea>
</div>
<div class="col-md-12 form-group">
<input type="submit" class="btn btn-primary" value="<?php echo LANG_VALUE_46; ?>" name="form3">
</div>
</form>
</div>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php require_once('footer.php'); ?>