-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder_confirmation.php
More file actions
109 lines (98 loc) · 4.36 KB
/
Copy pathorder_confirmation.php
File metadata and controls
109 lines (98 loc) · 4.36 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
<?php
session_start();
require 'db.php';
if (!isset($_SESSION['logged_in']) || $_SESSION['Category'] != 0) {
$_SESSION['message'] = "Please login as a buyer to view order confirmation!";
header("Location: Login/error.php");
exit();
}
$order_id = isset($_GET['order_id']) ? (int)$_GET['order_id'] : 0;
if ($order_id <= 0) {
$_SESSION['message'] = "Invalid order ID!";
header("Location: error.php");
exit();
}
// Fetch order details
$sql = "SELECT o.*, p.product, f.fname AS farmer_name, b.bname AS buyer_name
FROM orders o
JOIN fproduct p ON o.product_id = p.pid
JOIN farmer f ON o.farmer_id = f.fid
JOIN buyer b ON o.buyer_id = b.bid
WHERE o.order_id = $order_id AND o.buyer_id = {$_SESSION['id']}";
$result = mysqli_query($conn, $sql);
$order = mysqli_fetch_assoc($result);
if (!$order) {
$_SESSION['message'] = "Order not found!";
header("Location: error.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Order Confirmation - Agrilink</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="assets/css/style.css">
<script src="js/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-layers.min.js"></script>
<script src="js/init.js"></script>
<link rel="stylesheet" href="Blog/commentBox.css" />
<noscript>
<link rel="stylesheet" href="css/skel.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-xlarge.css" />
</noscript>
</head>
<body>
<?php require 'menu.php'; ?>
<div class="container my-4">
<div class="row">
<div class="col-md-8 offset-md-2">
<div class="card">
<div class="card-header bg-success text-white">
<h3>Order Confirmed Successfully!</h3>
</div>
<div class="card-body">
<div class="alert alert-success">
<h4>Thank you, <?php echo htmlspecialchars($order['buyer_name']); ?>!</h4>
<p>Your order has been successfully placed and confirmed.</p>
</div>
<div class="order-details mb-4">
<h4>Order Details</h4>
<p><strong>Order ID:</strong> #<?php echo $order_id; ?></p>
<p><strong>Product:</strong> <?php echo htmlspecialchars($order['product']); ?></p>
<p><strong>Quantity:</strong> <?php echo (int)$order['quantity']; ?> units</p>
<p><strong>Total Price:</strong> KES <?php echo number_format($order['price'] * $order['quantity'], 2); ?></p>
<p><strong>Farmer:</strong> <?php echo htmlspecialchars($order['farmer_name']); ?></p>
</div>
<div class="pickup-info mb-4">
<h4>Pickup Information</h4>
<div class="alert alert-info">
<p><strong>Pickup Location:</strong></p>
<p>Local Warehouse<br>
Agrilink Distribution Center<br>
123 Market Street<br>
Business Hours: 9:00 AM - 5:00 PM</p>
<p><strong>Bring with you:</strong></p>
<ul>
<li>Your order confirmation number (#<?php echo $order_id; ?>)</li>
<li>Valid ID</li>
</ul>
</div>
</div>
<div class="text-center">
<a href="chat.php?order_id=<?php echo $order_id; ?>" class="btn btn-primary">View Order Chat</a>
<a href="productMenu.php" class="btn btn-secondary">Continue Shopping</a>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
</body>
</html>