Файловый менеджер - Редактировать - /home/skymarketplace/public_html/order_summary.php
Назад
<?php include 'include/header.php'; include_once './admin/include/auth.php'; // Initialize variables $orderDetails = null; $errorMessage = ""; $auth = new auth(); // Check if user is logged in if (!isset($_SESSION['uid'])) { $errorMessage = "You must be logged in to view order details."; } // Check if order ID is provided else if (!isset($_GET['order_id'])) { $errorMessage = "No order ID specified. Please check your order history."; } else { $orderId = $_GET['order_id']; $userId = $_SESSION['uid']; // Fetch order details $orderDetails = $auth->getOrderDetails($orderId, $userId); // Debug information if (!$orderDetails) { $errorMessage = "Order not found or you don't have permission to view it."; // For debugging purposes error_log("Failed to fetch order ID: $orderId for user ID: $userId"); // Get all orders for this user to see if any exist $allOrders = $auth->getUserOrders($userId); if ($allOrders && count($allOrders) > 0) { error_log("User has " . count($allOrders) . " orders, but requested order not found"); } else { error_log("User has no orders at all"); } } } ?> <style> /* General Styles */ body { font-family: 'Roboto', sans-serif; margin: 0; padding: 0; background-color: #f9f9f9; color: #333; } .main-container { width: 100%; padding: 20px; } .page-title { font-size: 32px; font-weight: bold; color: #333; text-align: center; margin-bottom: 20px; } .order-info, .order-tracking, .contact-section { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); margin-bottom: 30px; } .order-table th, .order-table td { padding: 10px; text-align: left; font-size: 16px; } .order-table th { background-color: #f4f4f4; font-weight: bold; } .alert-danger { background-color: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; padding: 15px; border-radius: 5px; margin-bottom: 30px; } .btn { padding: 10px 15px; border: none; cursor: pointer; font-size: 16px; border-radius: 5px; text-decoration: none; margin: 5px; } .btn-primary { background-color: #007bff; color: white; } .btn-track { background-color: #28a745; color: white; } .btn-whatsapp { background-color: #25D366; color: white; } .btn-call { background-color: #007bff; color: white; } .contact-buttons a { display: inline-block; } /* Product Grid */ .order-products { margin-top: 30px; } .products-grid { display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-around; } .product-card { background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); width: calc(33% - 20px); text-align: center; transition: transform 0.3s ease; } .product-card:hover { transform: scale(1.05); } .product-card img { width: 100%; height: auto; border-radius: 8px; } .product-card h4 { font-size: 18px; margin-top: 10px; color: #333; } .product-card p { font-size: 14px; color: #777; margin-bottom: 10px; } .product-card .price { font-size: 16px; font-weight: bold; color: #000; } /* Responsive Design */ @media (max-width: 768px) { .product-card { width: calc(50% - 20px); } } @media (max-width: 480px) { .product-card { width: 100%; } } </style> <div class="main-container" id="container"> <div id="content" class="main-content"> <div class="layout-px-spacing"> <h2 class="page-title">Order Summary</h2> <?php if (!empty($errorMessage)): ?> <div class="alert alert-danger"> <p><?php echo $errorMessage; ?></p> <a href="orders.php" class="btn btn-primary">View All Orders</a> </div> <?php else: ?> <!-- Order Info Section --> <div class="order-info"> <h3>Order Details</h3> <table class="order-table"> <tr> <th>Order ID</th> <td><?= $orderDetails['id'] ?? 'N/A'; ?></td> </tr> <tr> <th>Order Date</th> <td><?= isset($orderDetails['created_at']) ? date('F j, Y', strtotime($orderDetails['created_at'])) : 'N/A'; ?></td> </tr> <tr> <th>Total Price</th> <td><?= isset($orderDetails['total_price']) ? number_format($orderDetails['total_price'], 2) . ' Ksh' : 'N/A'; ?></td> </tr> <tr> <th>Payment Method</th> <td><?= $orderDetails['payment_method'] ?? 'N/A'; ?></td> </tr> <tr> <th>Status</th> <td><?= $orderDetails['status'] ?? 'Processing'; ?></td> </tr> </table> </div> <!-- Products Section --> <div class="order-products"> <h3>Products in this Order</h3> <div class="products-grid"> <?php foreach($orderDetails['products'] as $item): ?> <div class="product-card"> <img src="uploads/products/<?= htmlspecialchars($item['product_image']) ?>" alt="<?= htmlspecialchars($item['product_name']) ?>"> <h4><?= htmlspecialchars($item['product_name']) ?></h4> <p><?= htmlspecialchars($item['product_description']) ?></p> <p class="price"><?= number_format($item['product_price'], 2) ?> Ksh</p> <p>Quantity: <?= (int)$item['quantity'] ?></p> </div> <?php endforeach; ?> </div> </div> <!-- Tracking Section --> <div class="order-tracking"> <h3>Track Your Order</h3> <p>Your order is currently being processed. You can track it using the link below.</p> <a href="track_order.php?order_id=<?= $orderDetails['id']; ?>" class="btn btn-track">Track Order</a> </div> <!-- Contact Section --> <div class="contact-section"> <h3>Need Help? Contact Sales</h3> <p>If you have any questions, you can contact our sales team via WhatsApp or call:</p> <div class="contact-buttons"> <a href="https://wa.me/1234567890" target="_blank" class="btn btn-whatsapp">Chat with Sales Team (WhatsApp)</a> <a href="tel:+1234567890" class="btn btn-call">Call Sales Team</a> </div> </div> <?php endif; ?> </div> </div> </div> <?php include 'include/footer.php'; ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.31 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка