-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexist_order.php
More file actions
170 lines (153 loc) · 6.59 KB
/
exist_order.php
File metadata and controls
170 lines (153 loc) · 6.59 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
<?php
session_start();
include_once("admin/class/adminback.php");
$obj = new adminback();
$cata_info = $obj->p_display_catagory();
$cataDatas = array();
while ($data = mysqli_fetch_assoc($cata_info)) {
$cataDatas[] = $data;
}
$userid = $_SESSION['user_id'];
$username = $_SESSION['username'];
if (isset($_GET['logout'])) {
if ($_GET['logout'] == "logout") {
$obj->user_logout();
}
}
if (isset($_SESSION['user_id'])) {
$id = $_SESSION['user_id'];
$limit = 5;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($page - 1) * $limit;
$total_orders = $obj->get_total_orders($id);
$order_query = $obj->order_details_by_id($id, $offset, $limit);
$total_pages = ceil($total_orders / $limit);
} else {
header("location:user_login.php");
}
?>
<?php
include_once("includes/head.php");
?>
<style>
.pagination {
display: inline-block;
margin-top: 20px;
}
.pagination a {
color: black;
float: left;
padding: 8px 16px;
text-decoration: none;
}
.pagination a.active {
background-color: #4CAF50;
color: white;
}
.pagination a:hover:not(.active) {
background-color: #ddd;
}
</style>
<body class="biolife-body">
<?php
include_once("includes/preloader.php");
?>
<header id="header" class="header-area style-01 layout-03">
<?php
include_once("includes/header_top.php");
include_once("includes/header_middle.php");
include_once("includes/header_bottom.php");
?>
</header>
<div class="page-contain">
<div id="main-content" class="main-content">
<div class="container">
<div class="row">
<div class="col-md-2">
<h4>Hello <?php echo strtoupper($username); ?></h4>
<a href="?logout=logout">Logout</a>
</div>
<div class="col-md-10">
<h2 class="text-center">Order Summary</h2>
<table class="shop_table cart-form">
<thead>
<tr>
<th class="product-name">Order Id</th>
<th class="product-subtotal">Total Amount</th>
<th class="product-subtotal">Order Status</th>
<th class="product-subtotal">Placing Time</th>
</tr>
</thead>
<tbody>
<?php
while ($order_info = mysqli_fetch_assoc($order_query)) {
$order_id = $order_info['order_id'];
$total_amount = $order_info['total_amount'];
$order_status = $order_info['order_status'];
$order_time = $order_info['order_time'];
?>
<tr class="cart_item" onclick="window.location='order_details.php?order_id=<?php echo $order_id; ?>'">
<td class="product-thumbnail" data-title="Order ID">
<div class="price price-contain">
<span class="price-amount"><?php echo $order_id; ?></span>
</div>
</td>
<td class="product-subtotal" data-title="Total Amount">
<div class="price price-contain">
<span class="price-amount"><?php echo $total_amount; ?></span>
</div>
</td>
<td class="product-subtotal" data-title="Status">
<div class="">
<span class="price-amount">
<?php
if ($order_status == 0) {
echo "<p class='btn btn-danger btn-sm'> Pending </p>";
} elseif ($order_status == 1) {
echo "<p class='btn btn-warning btn-sm'> Processing </p>";
} elseif ($order_status == 2) {
echo "<p class='btn btn-success btn-sm'> Delivered </p>";
} elseif ($order_status == 3) {
echo "<p class='btn btn-inverse btn-sm'> Cancelled </p>";
}
?>
</span>
</div>
</td>
<td class="product-subtotal" data-title="Placing Time">
<div class="price price-contain">
<span class="price-amount"><?php echo $order_time; ?></span>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="pagination">
<?php
if ($page > 1) {
echo '<a href="?page=' . ($page - 1) . '">« Previous</a>';
}
for ($i = 1; $i <= $total_pages; $i++) {
echo '<a href="?page=' . $i . '" ' . ($i == $page ? 'class="active"' : '') . '>' . $i . '</a>';
}
if ($page < $total_pages) {
echo '<a href="?page=' . ($page + 1) . '">Next »</a>';
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include_once("includes/footer.php");
include_once("includes/mobile_footer.php");
include_once("includes/mobile_global.php");
?>
<a class="btn-scroll-top"><i class="biolife-icon icon-left-arrow"></i></a>
<?php
include_once("includes/script.php");
?>
</body>