🖥️ Server: LiteSpeed
💻 System: Linux in-mum-web1643.main-hosting.eu 5.14.0-687.46.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Sep 11 09:03:19 EDT 2026 x86_64
👤 User: u621169360 (621169360)
🐘 PHP: 8.2.33
🚫 Disabled: system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
📄 my-orders.php
📁 Path: /home/u621169360/domains/papayawhip-cod-251399.hostingersite.com/public_html/my-orders.php
📊 Size: 20.44 KB
🔒 Perm: 0644
📝 MIME: text/x-php
<?php
require_once __DIR__ . '/admin-panal/includes/db.php';
session_start();
$isLoggedIn = isset($_SESSION['customer_id']);
if (!$isLoggedIn) {
echo "<script>window.location.href='index.php';</script>";
exit;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-Z2X2T395KZ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-Z2X2T395KZ');
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Orders — Elegance of India</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body style="background:var(--bg)">
<?php require_once __DIR__ . '/inc/header.php'; ?>
<?php
$customerId = $_SESSION['customer_id'];
$viewOrderId = isset($_GET['view']) ? (int)$_GET['view'] : 0;
if ($viewOrderId > 0):
// DETAILED VIEW LOGIC
$stmt = $pdo->prepare("SELECT * FROM orders WHERE id = ? AND customer_id = ?");
$stmt->execute([$viewOrderId, $customerId]);
$order = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$order):
echo "<script>window.location.href='my-orders.php';</script>";
exit;
endif;
$stmtItems = $pdo->prepare("SELECT * FROM order_items WHERE order_id = ?");
$stmtItems->execute([$viewOrderId]);
$items = $stmtItems->fetchAll(PDO::FETCH_ASSOC);
?>
<main class="my-orders-page">
<div class="container" style="max-width: 900px; margin: 60px auto; padding: 0 20px;">
<div style="margin-bottom: 30px;">
<a href="my-orders.php" style="color: #666; text-decoration: none; font-size: 14px; display: flex; align-items: center; gap: 8px;">
<i class="fas fa-arrow-left"></i> Back to My Orders
</a>
</div>
<div class="order-detail-header" style="display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 40px; border-bottom: 2px solid #eee; padding-bottom: 20px;">
<div>
<h1 style="font-size: 32px; font-weight: 600; margin-bottom: 8px;">Order #<?= htmlspecialchars($order['order_number']) ?></h1>
<p style="color: #888; font-size: 14px;">Placed on <?= date('F j, Y, g:i a', strtotime($order['created_at'])) ?></p>
</div>
<div class="status-badge status-<?= strtolower($order['order_status']) ?>" style="padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 700; text-transform: uppercase;">
<?= htmlspecialchars($order['order_status']) ?>
</div>
</div>
<div class="detail-grid" style="display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px; margin-bottom: 40px;">
<div class="detail-col">
<h5 style="text-transform: uppercase; font-size: 12px; color: #999; letter-spacing: 1px; margin-bottom: 20px;">Items in your order</h5>
<div style="display: flex; flex-direction: column; gap: 20px;">
<?php foreach ($items as $item):
$m = json_decode($item['measurements'], true);
?>
<div class="detail-item" style="display: flex; gap: 20px; padding: 20px; background: #fff; border: 1px solid #eee; border-radius: 12px;">
<div style="width: 80px; height: 110px; flex-shrink: 0; border-radius: 4px; overflow: hidden; border: 1px solid #eee;">
<img src="<?= htmlspecialchars($item['image']) ?>" alt="" style="width: 100%; height: 100%; object-fit: cover;">
</div>
<div style="flex: 1;">
<div style="font-weight: 600; font-size: 16px; margin-bottom: 4px;"><?= htmlspecialchars($item['product_name']) ?></div>
<div style="color: #666; font-size: 13px;">Qty: <?= $item['quantity'] ?> · USD <?= number_format($item['price'], 2) ?></div>
<?php if (!empty($item['swatch_label'])): ?>
<div style="margin-top: 5px; font-size: 13px; color: #333;">Design: <span style="font-weight: 600;"><?= htmlspecialchars($item['swatch_label']) ?></span></div>
<?php endif; ?>
<?php if (!empty($item['design_code'])): ?>
<div style="margin-top: 2px; font-size: 12px; color: #222;">Design Code: <span style="font-weight: 600;"><?= htmlspecialchars($item['design_code']) ?></span></div>
<?php endif; ?>
<?php if ($item['size']): ?>
<div style="margin-top: 5px; font-size: 13px;">Size: <span style="font-weight: 600;"><?= htmlspecialchars($item['size']) ?></span></div>
<?php endif; ?>
<?php
if (!empty($item['addons'])) {
$addons = json_decode($item['addons'], true);
if (is_array($addons)) {
foreach ($addons as $addon) {
echo '<div style="margin-top: 5px; font-size: 13px; color: #555;">Add-on: <span style="font-weight: 600;">' . htmlspecialchars($addon['label']) . '</span> <span style="font-size: 11px; color: #888;">(+USD ' . number_format($addon['price'], 2) . ')</span></div>';
}
}
}
?>
<?php if ($m): ?>
<div style="margin-top: 15px; padding: 15px; background: #fcfcfc; border: 1px solid #f0f0f0; border-radius: 8px;">
<div style="font-size: 11px; font-weight: 700; text-transform: uppercase; color: #aaa; margin-bottom: 10px; display: flex; align-items: center; gap: 6px;">
<i class="fas fa-ruler-combined"></i> Measurements (<?= htmlspecialchars($m['unit'] ?? 'inches') ?>)
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 12px;">
<?php
// Fixed labels for common keys
$labels = [
'bust' => 'Bust', 'bodyHeight' => 'Height', 'naturalWaist' => 'Waist',
'shoulder' => 'Shoulder', 'armHole' => 'Arm Hole', 'fullHip' => 'Hip',
'waistFloor' => 'W-Floor', 'sleeveLength' => 'Sleeve Length',
'frontNeck' => 'Front Neck', 'backNeck' => 'Back Neck'
];
foreach ($m as $key => $val):
if ($key === 'unit' || empty($val)) continue;
// Use label if exists, otherwise format the key
$displayLabel = isset($labels[$key]) ? $labels[$key] : ucfirst(preg_replace('/(?<!^)[A-Z]/', ' $0', $key));
?>
<div style="display: flex; justify-content: space-between; border-bottom: 1px dashed #eee; padding-bottom: 2px;">
<span style="color: #888;"><?= $displayLabel ?>:</span>
<span style="font-weight: 600;"><?= htmlspecialchars($val) ?></span>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="detail-col">
<div style="background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 25px; margin-bottom: 20px;">
<h5 style="text-transform: uppercase; font-size: 11px; color: #999; letter-spacing: 1px; margin-bottom: 15px;">Shipping Address</h5>
<div style="font-size: 14px; line-height: 1.6; color: #333;">
<strong><?= htmlspecialchars($order['first_name'] . ' ' . $order['last_name']) ?></strong><br>
<?= htmlspecialchars($order['address1']) ?><br>
<?php if ($order['address2']) echo htmlspecialchars($order['address2']) . '<br>'; ?>
<?= htmlspecialchars($order['city']) ?>, <?= htmlspecialchars($order['state']) ?> <?= htmlspecialchars($order['postal_code']) ?><br>
<?= htmlspecialchars($order['country']) ?><br>
<span style="color: #888;">Phone:</span> <?= htmlspecialchars($order['phone']) ?>
</div>
</div>
<div style="background: #fff; border: 1px solid #eee; border-radius: 12px; padding: 25px;">
<h5 style="text-transform: uppercase; font-size: 11px; color: #999; letter-spacing: 1px; margin-bottom: 15px;">Order Summary</h5>
<div style="display: flex; flex-direction: column; gap: 10px;">
<div style="display: flex; justify-content: space-between; font-size: 14px; color: #666;">
<span>Subtotal</span><span>USD <?= number_format($order['subtotal'], 2) ?></span>
</div>
<div style="display: flex; justify-content: space-between; font-size: 14px; color: #666;">
<span>Shipping</span><span>USD <?= number_format($order['shipping'], 2) ?></span>
</div>
<div style="display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; color: #000; border-top: 1px solid #eee; padding-top: 15px; margin-top: 5px;">
<span>Total</span><span>USD <?= number_format($order['total'], 2) ?></span>
</div>
<div style="margin-top: 15px; font-size: 12px; color: #888; text-align: right;">
Payment Method: <span style="text-transform: uppercase; color: #333; font-weight: 600;"><?= htmlspecialchars($order['payment_method']) ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<?php else: ?>
<!-- LIST VIEW -->
<?php
// Fetch orders for this customer
$stmt = $pdo->prepare("SELECT * FROM orders WHERE customer_id = ? ORDER BY created_at DESC");
$stmt->execute([$customerId]);
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<main class="my-orders-page">
<div class="container" style="max-width: 1000px; margin: 60px auto; padding: 0 20px;">
<div class="page-header" style="margin-bottom: 40px; text-align: center;">
<h1 style="font-size: 32px; font-weight: 600; margin-bottom: 8px;">My Orders</h1>
<p style="color: #666; font-size: 14px;">Track and manage your recent purchases</p>
</div>
<?php if (empty($orders)): ?>
<div class="empty-orders" style="text-align: center; padding: 80px 20px; background: #fafafa; border-radius: 8px; border: 1px dashed #ddd;">
<i class="fas fa-box-open" style="font-size: 48px; color: #ccc; margin-bottom: 20px;"></i>
<h2 style="font-size: 20px; color: #333; margin-bottom: 10px;">No orders found</h2>
<p style="color: #888; margin-bottom: 30px;">You haven't placed any orders yet.</p>
<a href="shop.php" class="btn btn-gold" style="padding: 12px 30px;">Start Shopping</a>
</div>
<?php else: ?>
<div class="orders-list" style="display: flex; flex-direction: column; gap: 24px;">
<?php foreach ($orders as $order):
$orderId = $order['id'];
$stmtItems = $pdo->prepare("SELECT * FROM order_items WHERE order_id = ?");
$stmtItems->execute([$orderId]);
$items = $stmtItems->fetchAll(PDO::FETCH_ASSOC);
$statusClass = 'status-' . strtolower($order['order_status']);
?>
<div class="order-card" style="background: #fff; border: 1px solid #eee; border-radius: 12px; overflow: hidden; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0,0,0,0.03);">
<div class="order-card-header" style="padding: 20px 24px; background: #fcfcfc; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;">
<div style="display: flex; gap: 24px; flex-wrap: wrap;">
<div>
<div style="font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;">Order Placed</div>
<div style="font-size: 14px; color: #333; font-weight: 600;"><?= date('M j, Y', strtotime($order['created_at'])) ?></div>
</div>
<div>
<div style="font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;">Total</div>
<div style="font-size: 14px; color: #333; font-weight: 600;">USD <?= number_format($order['total'], 2) ?></div>
</div>
<div>
<div style="font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;">Ship To</div>
<div style="font-size: 14px; color: #333; font-weight: 600;"><?= htmlspecialchars($order['first_name']) ?></div>
</div>
</div>
<div style="text-align: right;">
<div style="font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px;">Order #<?= htmlspecialchars($order['order_number']) ?></div>
<div class="status-badge <?= $statusClass ?>" style="display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;">
<?= htmlspecialchars($order['order_status']) ?>
</div>
</div>
</div>
<div class="order-card-body" style="padding: 24px;">
<div class="order-items-summary" style="display: flex; flex-direction: column; gap: 16px;">
<?php foreach ($items as $item): ?>
<div class="order-item" style="display: flex; gap: 16px; align-items: center;">
<div style="width: 70px; height: 90px; flex-shrink: 0; background: #f5f5f5; border-radius: 4px; overflow: hidden; border: 1px solid #eee;">
<img src="<?= htmlspecialchars($item['image']) ?>" alt="" style="width: 100%; height: 100%; object-fit: cover;">
</div>
<div style="flex: 1;">
<div style="font-weight: 600; color: #333; font-size: 15px; margin-bottom: 4px;"><?= htmlspecialchars($item['product_name']) ?></div>
<?php if(!empty($item['swatch_label'])): ?>
<div style="font-size: 13px; color: #c9a96e; font-weight: 600; margin-bottom: 2px;">Design: <?= htmlspecialchars($item['swatch_label']) ?></div>
<?php endif; ?>
<div style="font-size: 13px; color: #666;">
Qty: <?= $item['quantity'] ?> ·
<?php if($item['size']) echo 'Size: ' . htmlspecialchars($item['size']); else echo 'Custom Stitched'; ?>
</div>
<?php
if (!empty($item['addons'])) {
$addons = json_decode($item['addons'], true);
if (is_array($addons)) {
foreach ($addons as $addon) {
echo '<div style="font-size: 12px; color: #888;">+ ' . htmlspecialchars($addon['label']) . '</div>';
}
}
}
?>
</div>
<div style="text-align: right;">
<div style="font-weight: 600; color: #333;">USD <?= number_format($item['price'], 2) ?></div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="order-card-footer" style="padding: 16px 24px; border-top: 1px solid #eee; display: flex; justify-content: flex-end; gap: 12px;">
<a href="my-orders.php?view=<?= $order['id'] ?>" class="btn btn-gold btn-sm" style="background: var(--gold); color: #fff; font-size: 12px; padding: 8px 16px; border-radius: 4px; text-decoration: none;">Order Details</a>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</main>
<?php endif; ?>
<style>
.status-pending { background: #fff8e1; color: #ff8f00; }
.status-processing { background: #e3f2fd; color: #1976d2; }
.status-shipped { background: #e8f5e9; color: #2e7d32; }
.status-cancelled { background: #ffebee; color: #c62828; }
.order-card:hover {
box-shadow: 0 8px 25px rgba(0,0,0,0.06);
transform: translateY(-2px);
}
.btn-gold:hover {
background: #b6965d !important;
}
</style>
<?php require_once __DIR__ . '/inc/footer.php'; ?>
</body>
</html>
<?php require_once __DIR__ . '/inc/footer.php'; ?>
</body>
</html>
✨ File Manager Magic ✨