-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorder.php
190 lines (138 loc) · 5.8 KB
/
order.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
<?php
//Tell PHP to log errors
ini_set('log_errors', 'On');
//Tell PHP to not display errors
ini_set('display_errors', 'Off');
//Set error_reporting to E_ALL
ini_set('error_reporting', E_ALL );
include '_dbConnect.php';
// Start the session
session_start();
$uid = $_GET['uid'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Tab Icon -->
<link rel="icon" href="assests/images/logo.png" type="image/icon type">
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<link rel='stylesheet'
href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css' />
<!-- font awesome cdn link -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.2/css/all.min.css">
<link rel="stylesheet" href="assests/css/style.css">
<link rel="stylesheet" href="assests/css/Product.css">
<link rel="stylesheet" href="assests/css/ProPage.css">
<title>Order History</title>
</head>
<body>
<!-- header section -->
<header id="topheader" style="background:black">
<?php include 'header.php'; ?>
<?php
if($_SESSION['clearOrder']) {
$_SESSION['clearOrder'] = false;
echo '<div class="alert text-center alert-warning alert-dismissible fade show mb-0" role="alert" style="z-index:1000">
Order History Cleared!
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>';
} ?>
<?php include 'login_signup.php'; ?>
</header>
<!-- header section ends -->
<!-- ******************************************************************************************************** -->
<main>
<section style="margin-top:220px">
<?php
$uid = $_SESSION['uid'];
$sql = "select * from orderhistory where uid='$uid' order by date desc";
$result = mysqli_query($conn,$sql);
$num_row = mysqli_num_rows($result);
if(!$num_row)
{
echo '<div align="center" class="mt-5"><img src="assests/images/order.jpg" alt="empty wishlist" style="width:50%" class="img-fluid" ></div>';
}
if($num_row) : ?>
<h1 class="text-center mb-5" style="color:var(--gold)">ORDER HISTORY</h1>
<a href="clearOrder.php?uid=<?= $uid?>" class="bg-danger text-white px-3 py-3" onclick="return confirm('Are you sure want to clear your order history?');"><i class="fas fa-trash"></i> Clear Order History</a>
<?php
while($row = mysqli_fetch_assoc($result)) : ?>
<div class="mx-5 py-5" style="background: #fff1e3">
<div class="text-center mx-5" style="font-size:2rem;">ORDER ID : <?= "OD".$row["oid"] ?></div>
<div class="text-center mb-5 pb-5" style="font-size:1.5rem;">DATE : <?= $row["date"] ?></div>
<?php $oid = $row['oid']; ?>
<?php
$sqll = "select * from `checkoutProducts` where uid='$uid' and oid='$oid'";
$resultt = mysqli_query($conn,$sqll);
$roww = mysqli_fetch_assoc($resultt);
foreach($resultt as $roww) :
?>
<?php
$pid = $roww['pid'];
$pprice = $roww['product_price'];
$qty = $roww['qty'];
$sqlll = "select * from `products` where pid='$pid'";
$resulttt = mysqli_query($conn,$sqlll);
$rowww = mysqli_fetch_assoc($resulttt);
?>
<div class="row mx-5">
<div class="col-md-6" align="center"><img src="<?= $rowww['photo'] ?>" alt="product image" class="img-fluid" style="width:30%"></div>
<div class="col-md-6 pt-4">
<div><b><?= strtoupper($rowww['pname']) ?></b></div>
<?php if($rowww['offer']){
$discount = $rowww["pprice"] - (($rowww["pprice"]*$rowww["offer"])/100);
$discount = intval($discount);
echo'
<h5 class="off-percent">' . $rowww["offer"] .'% off</h5>
<p class="product-price-strike"> INR '. number_format($rowww["pprice"]) .'/-</p>
<p class="product-price"> INR '. number_format($discount) .'/-</p>';
}
else
{
echo '<p class="product-price"> INR '. number_format($rowww["pprice"]) .'/-</p>';
}?>
<div>Quantity : <?= $qty ?></div>
</div>
</div>
<br> <br>
<?php endforeach; ?>
<div class="mt-5 mx-5 text-center">Amount Paid : $ <?= number_format($row['amount_paid'],2) ?>/-</div>
</div> <br> <br> <br>
<?php endwhile; ?>
<?php endif; ?>
</section>
<!-- footer section -->
<?php include 'footer.php'; ?>
</main>
<script src="assests/js/main.js"></script>
<!-- Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// Load total no.of items added in the cart and display in the navbar
load_cart_item_number();
function load_cart_item_number() {
$.ajax({
url: 'action.php',
method: 'get',
data: {
cartItem: "cart_item"
},
success: function(response) {
$("#cart-item").html(response);
}
});
}
});
</script>
</body>
</html>