-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheckout.php
170 lines (144 loc) · 6.07 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
<?php
require_once 'php/autoload.php';
session_start();
if (!isset($_SESSION['user']->id)) header('location: ./');
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="shortcut icon" href="favicon.png" />
<title>Checkout</title>
<link rel="stylesheet" href="css/general.css" />
<link rel="stylesheet" href="css/checkout.css">
<link rel="stylesheet" href="css/header.css" />
<link rel="stylesheet" href="css/form.css" />
<script src="js/jquery/jquery-3.3.1.min.js"></script>
<script src="js/cart.js"></script>
<script>
$(function() {
var currentTab = 'cart-checkout';
$('.nav-button').click(function() {
nextTab = $(this).attr('val');
if ($(this).attr('multiNav') == '1')
nextTab += '-' + $('input[name="payment_cb"]:checked').attr('value');
$('#' + currentTab).slideUp('medium', function() {
$('#' + nextTab).slideDown('medium');
});
currentTab = nextTab;
});
});
</script>
</head>
<body style="background-image: url('img/checkout-form-background.jpg');">
<div id="main-container">
<div class="form-container">
<div class="form-header">
<img src="img/payment.png" alt="image error" />
<h2>Checkout</h2>
</div>
<div id="cart-checkout">
<h1>Cart Content</h1>
<div id="cart-items-container"></div>
<div id="cart-pay-section"></div>
<button val="payment-method" class="nav-button styled-btn sb-green">Continue</button>
</div>
<div id="payment-method" style="display: none;">
<h1>Payment Method</h1>
<div class="payment-method-tab">
<div class="payment-method-tab-check">
<input type="radio" name="payment_cb" value="CC" checked>
<img src="img/credit-card.png">
<h2>Credit Cart</h2>
</div>
<p>Pay using your credit card like Visa card or Master card</p>
</div>
<div class="payment-method-tab">
<div class="payment-method-tab-check">
<input type="radio" name="payment_cb" value="CCP">
<img src="img/paypal-card.png">
<h2>PayPal</h2>
</div>
<p>Pay using your PayPal account</p>
</div>
<div class="payment-method-tab" style="border: 0;">
<div class="payment-method-tab-check">
<input type="radio" name="payment_cb" value="LIV">
<img src="img/shipping.png">
<h2>Payment on delivery</h2>
</div>
<p>Pay hand-to-hand with our agent on delivery</p>
</div>
<div class="double-button-container">
<button val="cart-checkout" class="nav-button styled-btn sb-red">Back</button>
<button val="payment-method" multiNav="1" class="nav-button styled-btn sb-green">Continue</button>
</div>
</div>
<!-- Payment methods -->
<div id="payment-method-CC" style="display: none;">
<form class="payment-method-form" action="php/actions/checkout.php" method="post">
<span>Card number</span>
<input type="text" placeholder="XXXXXXXXX" minlength="5" maxlength="10">
<span>Expiration date</span>
<input type="text" placeholder="MM/YY" pattern="[0-9]{1,2}/[0-9]{1,2}">
<span>CVC code</span>
<input type="text" placeholder="XXXX" size="4" minlength="4" maxlength="4">
<span>Shipping address</span>
<input name="shipping_address" value="<?= $_SESSION['user']->address ?>" type="text" minlength="5" required>
<div class="double-button-container">
<button type="button" val="payment-method" class="nav-button styled-btn sb-red">Back</button>
<button type="submit" name="payment_method" value="credit_card" class="styled-btn sb-green">Continue</button>
</div>
<div class="notice-div">
Payment gets handled here.<br><br>
This is just a demo site don't enter any real data,
the payment will succeed no mater the input<br><br>
This site was made by<br> <a href="https://rebrand.ly/riad-hachemane-portfolio" target="_blank">Riad Hachemane</a>
</div>
</form>
</div>
<div id="payment-method-CCP" style="display: none;">
<form class="payment-method-form" action="php/actions/checkout.php" method="post">
<span>PayPal payment gets handled here ...</span><br>
<span>Shipping address</span>
<input name="shipping_address" type="text" value="<?= $_SESSION['user']->address ?>" minlength="5" required>
<div class="double-button-container">
<button type="button" val="payment-method" class="nav-button styled-btn sb-red">Back</button>
<button type="submit" name="payment_method" value="paypal" class="styled-btn sb-green">Continue</button>
</div>
<div class="notice-div">
Payment gets handled here.<br><br>
This is just a demo site don't enter any real data,
the payment will succeed no mater the input<br><br>
This site was made by<br> <a href="https://rebrand.ly/riad-hachemane-portfolio" target="_blank">Riad Hachemane</a>
</div>
</form>
</div>
<div id="payment-method-LIV" style="display: none;">
<form class="payment-method-form" action="php/actions/checkout.php" method="post">
<span>Shipping address</span>
<input name="shipping_address" type="text" value="<?= $_SESSION['user']->address ?>" minlength="5" required>
<div class="double-button-container">
<button type="button" val="payment-method" class="nav-button styled-btn sb-red">Back</button>
<button type="submit" name="payment_method" value="on_delivery" class="styled-btn sb-green">Continue</button>
</div>
<div class="notice-div">
Payment gets handled here.<br><br>
This is just a demo site don't enter any real data,
the payment will succeed no mater the input<br><br>
This site was made by<br> <a href="https://rebrand.ly/riad-hachemane-portfolio" target="_blank">Riad Hachemane</a>
</div>
</form>
</div>
<div id="payment-end" style="display: none;">
<h2>Payment Effectuer Avec Success ! </h2>
<br>
<a href="index.php"><button style="width: 100%" class="nav-button styled-btn">Back au store</button></a>
</div>
<span id="switch_span"><a href="index.php">Go back to store</a></span>
</div>
</div>
<footer></footer>
</body>
</html>