-
Notifications
You must be signed in to change notification settings - Fork 4
/
order.php
99 lines (91 loc) · 3.5 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
<?php
session_start();
include 'connection.php';
include 'header.php';
$cust_id = 0;
?>
<html>
<body>
<!-- SIdeNav Mobile -->
<div id="mySidenav" class="sidenav">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<input type="text" id="mySearch" onkeyup="myFunction()" placeholder="Search.." title="Type in a category">
<a href="02.html">Women</a>
<a href="02.html">Jeans</a>
<a href="02.html">Jackets</a>
<a href="02.html">Best Sales</a>
</div>
<!-- Script for SideNav Mobile -->
<script>
function openNav() {
if (document.getElementById("mySidenav").style.width == "250px") {
document.getElementById("mySidenav").style.width = "0";
} else {
document.getElementById("mySidenav").style.width = "250px";
}
}
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
}
</script>
<h2 style="text-align: center;">Order Placed Successfully!</h2>
<h3 style="text-align: center;">Ordered Items: </h3>
<div class="o_body">
<div class="orders">
<hr style="width: 98%;">
<?php
$cust_id = 0;
if(!empty($_SESSION["loggedin"])){
$cust_id = $_SESSION["id"];
}
$sql = "SELECT p.pro_id, p.pro_name, p.price, p.pro_img, c.pro_size , c.pro_quantity, o.o_id, o.o_date, o.o_status FROM products p
LEFT JOIN cart c ON p.pro_id = c.pro_id
LEFT JOIN orders o ON o.cus_id = c.cus_id
WHERE o.cus_id = $cust_id && c.ordered = 1 && o.o_id = c.order_id ORDER BY o.o_id DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo '<div class="chitem">
<img style="width: 15%; margin-left: 10px;" src="'. $row["pro_img"] .'"></img>
<div class="chcol2">
<a style="text-align:left; margin-left:10px; font-size:larger;" href="product.php?'. $row["pro_id"] .'">'. $row["pro_name"] .'</a>
<div class="chp">
<p>Size: '. $row["pro_size"] .' regular</p>
<p>PKR '. $row["price"] .'</p>
<p>Order Number: '. $row["o_id"] .'</p>
<p>Ordered On: '. $row["o_date"] .'</p>
<p style="color: blue;">Order Status: '. $row["o_status"] .'</p>
</div>
</div>
<div class="qselector" style="display:flex; justify-content: center; column-gap: 10px;">
<p style="margin-top:0;">Quantity: '. $row["pro_quantity"] .'</p>
</div>
<div class="chprice">
<p>PKR '. $row["price"] * $row["pro_quantity"].'</p>
</div>
</div>
<hr style="width: 98%;">';
}
}
?>
</div>
</div>
<!-- Script for NotiWindow-->
<script>
var modal = document.getElementById("NotiWindow");
var span = document.getElementsByClassName("Noticlose")[0];
function displayNoti() {
modal.style.display = "block";
}
span.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>