This repository was archived by the owner on Apr 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyOrder.php
More file actions
executable file
·193 lines (156 loc) · 6.61 KB
/
Copy pathmyOrder.php
File metadata and controls
executable file
·193 lines (156 loc) · 6.61 KB
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
<?php
include('boilerplate.php');
if (!isset($_SESSION['email']) ) {
echo '<script>
location.href="error.php"
</script>';
}
$per_page = 12;
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start_from = ($page - 1) * $per_page;
$sql = "SELECT * FROM orders WHERE customer_id = '$customer_id' ORDER BY created_date DESC LIMIT $start_from, $per_page";
$run = mysqli_query($connect, $sql);
$count = mysqli_num_rows($run);
if ($count != 0) {
echo '<section class="borderless-table carousel-info">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="cart-table">
<table>
<thead>
<tr>
<th>Order No</th>
<th>Status</th>
<th>Shipping</th>
<th>Qty</th>
<th>Total</th>
<th>Time</th>
<th>Details</th>
<th>Invoice</th>
</tr>
</thead>
<tbody>';
while ($row = mysqli_fetch_assoc($run)) :
$id = $row['order_id'];
?>
<tr>
<td class="cart-title first-row">
<span style="font-size:1.1em;" class="badge badge-light"><?php echo $id ?></span>
</td>
<td class="cart-title first-row">
<?php if ($row['status'] == 0) { ?>
<span class="badge badge-danger">Cancelled</span>
<?php } else if ($row['status'] == 1) { ?>
<span class="badge badge-warning">Placed</span>
<?php } else if ($row['status'] == 2) { ?>
<span class="badge badge-success">Approved</span>
<?php } else if ($row['status'] == 3) { ?>
<span class="badge badge-info">Shipped</span>
<?php } else if ($row['status'] == 4) { ?>
<span class="badge badge-success">Deliverd</span>
<?php } else if ($row['status'] == 5) { ?>
<span class="badge badge-info">Refund Requested</span>
<?php } else if ($row['status'] == 6) { ?>
<span class="badge badge-success">Refunded</span>
<?php } else { ?>
<span class="badge badge-danger">Error</span>
<?php } ?>
</td>
<td class="cart-title first-row">
<?php if ($row['store_id'] == 0) { ?>
<span class="badge badge-secondary">Home Delivery</span>
<?php } else {
echo '<span class="badge badge-info">Store Pickup</span>';
} ?>
</td>
<td class="cart-title first-row">
<span class="badge badge-light">
<?php echo $row['total_qty'] ?></span>
</td>
<td class="cart-title first-row">
<span class="badge badge-success">₹ <?php echo $row['total_amt'] ?></span>
</td>
<td class="cart-title first-row">
<span class="badge badge-light">
<?php echo $row['created_date'] ?></span>
</td>
<td class="cart-title first-row">
<a style="color:#F67E29;" href="orderDetail.php?id=<?php echo $id ?>" >
<i class="fas fa-info-circle"></i></a>
</td>
<td class="cart-title first-row">
<a style="color:grey;" href="invoice.php?id=<?php echo $id ?>">
<i class="fas fa-file-alt"></i></a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
<style>
.center {
text-align: center;
}
.pagination {
display: inline-block;
margin-top: 15px;
margin-bottom: 15px;
}
.pagination a {
color: grey;
float: left;
padding: 8px 16px;
text-decoration: none;
transition: .3s;
}
.pagination a.active {
background-color: #66fcf1;
color: black;
}
.pagination a:hover:not(.active) {
background-color: #66fcf1;
color: black;
}
</style>
<?php
$query = "SELECT * FROM orders WHERE customer_id = '$customer_id'";
$result = mysqli_query($connect, $query);
$total_posts = mysqli_num_rows($result);
$total_pages = ceil($total_posts / $per_page);
$page_url = $_SERVER['PHP_SELF'];
echo "<div class='center'><div class='pagination justify-content-center'>";
echo "
<a href ='$page_url?page=1'>First</a>";
for ($i = 1; $i <= $total_pages; $i++) : ?>
<a class="<?php if ($page == $i) {
echo 'active';
} ?>" href="<?php echo $page_url ?>?page=<?= $i; ?>"> <?= $i; ?> </a>
<?php endfor;
echo "<a href='$page_url?page=$total_pages' >Last</a>";
echo "</div></div>";
?>
<?php
} else {
echo '
<div class="container">
<div class="row my-5">
<div class="col-md-12 text-center">
<span class="icon-exclamation-circle display-1 text-danger"></span>
<h2 class="display-3 text-black">No order placed!</h2>
<p class="display-5 mb-5">You can check our bestseller section</p>
<p><a href="index.php" class="btn btn-sm btn-info">Continue Shopping</a></p>
</div>
</div>
</div>';
}
?>
<?php include('footer.php'); ?>