-
Notifications
You must be signed in to change notification settings - Fork 2
/
order_cnf.php
253 lines (228 loc) · 9.22 KB
/
order_cnf.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
<?php
session_start();
// checking if user is logged in or not
if (!isset($_SESSION['customer'])) {
header("Location: login.php");
}
// including database connection
require('env/database.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Order Confirmed</title>
<link rel="icon" type="image/x-icon" href="assets/svg-logo/logo-bg.svg">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" />
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://kit.fontawesome.com/db79afedbd.js" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" media="screen" href="assets/css/main.css" />
</head>
<body>
<!------------------------------------------------------Loading Screen-------------------------------------------------------- -->
<div id="loading">
<img src="assets/svg-logo/LOADER.svg" alt="Loading..." />
</div>
<script>
var loader = document.getElementById("loading");
window.addEventListener("load", function() {
loader.style.display = "none";
})
</script>
<?php include 'header.php'; ?>
<!-- Body --------------------------------------------------------------->
<?php
// getting user details from session
if (isset($_SESSION['customer'])) {
$email = $_SESSION['customer'];
// getting user name from database
$sql = "SELECT * FROM user WHERE user_email = '$email'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$user_name = $row['user_name'];
$first_name = substr($user_name, 0, strpos($user_name, " "));
}
// getting order details from database
$order_id = $_GET['order_id'];
$sql = "SELECT * FROM orders WHERE order_id = '$order_id'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$order_date = $row['order_date'];
$order_status = $row['order_status'];
$order_discount = $row['discount'];
?>
<div class="container mt-5 mb-5">
<div class="row d-flex justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="text-left logo p-2 px-5">
<img src="app\asset\image\logo.svg" width="100" />
</div>
<div class="invoice p-3">
<div class="d-flex justify-content-between">
<div>
<h5>Your order Confirmed!</h5>
</div>
<div>
<!-- download invoice -->
<a href="invoice.php?orderId=<?php echo $order_id; ?>" class="">Invoice<i class="fas fa-download ms-2"></i></a>
</div>
</div>
<span class="font-weight-bold d-block mt-4">Hello, <?php echo $first_name; ?></span>
<span>You order has been confirmed and will be shipped in next two
days!</span>
<div class="payment border-top mt-3 mb-3 border-bottom table-responsive">
<table class="table table-borderless">
<tbody>
<tr>
<td>
<div class="py-2">
<span class="d-block text-muted">Order Date</span>
<span><?php echo $order_date; ?></span>
</div>
</td>
<td>
<div class="py-2">
<span class="d-block text-muted">Order No</span>
<span><?php echo $order_id; ?></span>
</div>
</td>
<td>
<div class="py-2">
<span class="d-block text-muted">Payment</span>
<span>Cash On delivery</span>
</div>
</td>
<td>
<div class="py-2">
<span class="d-block text-muted">Order Status</span>
<span><?php echo $order_status; ?></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="product border-bottom table-responsive">
<table class="table table-borderless">
<tbody>
<?php
$total = 0;
// fetching order details from database
$sql = "SELECT * FROM order_p
INNER JOIN product ON product.product_id = order_p.order_item
WHERE order_p.order_id = '$order_id'";
$result = mysqli_query($conn, $sql);
// showing all order details inn loop
while ($row1 = mysqli_fetch_assoc($result)) {
$product_name = $row1['product_name'];
$product_price = $row1['product_price'];
$product_img = $row1['product_img'];
$product_qty = $row1['order_qu'];
$product_total = $product_price * $product_qty;
?>
<tr>
<td width="20%">
<img src="<?php echo $product_img; ?>" width="90" />
</td>
<td width="60%">
<span class="font-weight-bold"><?php echo $product_name; ?></span>
<div class="product-qty">
<span class="d-block">Quantity:<?php echo $product_qty; ?> Pcs</span>
<!-- <span>Color:Dark</span> -->
</div>
</td>
<td width="20%">
<div class="text-right">
<span class="font-weight-bold">₹ <?php echo $product_price; ?></span>
</div>
</td>
</tr>
<?php
$total = $total + $product_total;
}
?>
</tbody>
</table>
</div>
<div class="row d-flex justify-content-end">
<div class="col-md-5">
<table class="table table-borderless">
<tbody class="totals">
<tr>
<td>
<div class="text-left">
<span class="text-muted">Subtotal</span>
</div>
</td>
<td>
<div class="text-right">
<span>₹ <?php echo $total; ?></span>
</div>
</td>
</tr>
<tr>
<td>
<div class="text-left">
<span class="text-muted">Shipping Fee</span>
</div>
</td>
<td>
<div class="text-right">
<span>₹ 0</span>
</div>
</td>
</tr>
<tr>
<td>
<div class="text-left">
<span class="text-muted">Discount</span>
</div>
</td>
<td>
<div class="text-right">
<span class="text-success"><?= $order_discount ?> %</span>
</div>
</td>
</tr>
<tr class="border-top border-bottom">
<td>
<div class="text-left">
<span class="font-weight-bold">Total</span>
</div>
</td>
<td>
<div class="text-right">
<span class="font-weight-bold">₹ <?php echo $total - ($total * $order_discount / 100); ?></span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p>
We will be sending shipping confirmation email when the item
shipped successfully!
</p>
<p class="font-weight-bold mb-0">Thanks for shopping with us!</p>
<span>Grapple Team</span>
</div>
<div class="d-flex justify-content-between footer p-3">
<span>Need Help? visit our
<a href="contact_us.php"> help center</a></span>
<span>© 2023 Grapple Inc. All rights reserved</span>
</div>
</div>
</div>
</div>
</div>
<!-- Footer --------------------------------------------------------------->
<?php include 'footer.php'; ?>
</body>
</html>