prepare(" SELECT oi.order_id, oi.product_id, oi.size, p.name, p.category FROM order_items oi JOIN products p ON oi.product_id = p.product_id WHERE p.owner_id = ? ORDER BY oi.order_id DESC LIMIT 5 "); $debug_stmt->execute([$_SESSION['user_id']]); $debug_items = $debug_stmt->fetchAll(); error_log("Recent order items with sizes: " . print_r($debug_items, true)); // Get all orders with customer info for products owned by this owner $stmt = $pdo->prepare(" SELECT o.order_id, o.order_date, o.total_amount, o.status, o.pickup_schedule, u.username AS customer_username, u.first_name, u.last_name, GROUP_CONCAT( CONCAT( p.name, CASE WHEN p.category = 'clothes' AND oi.size IS NOT NULL AND oi.size != '' THEN CONCAT(' (Size: ', oi.size, ')') ELSE '' END, ' x', oi.quantity ) ORDER BY p.name SEPARATOR ', ' ) as order_items, COUNT(DISTINCT oi.product_id) as item_count FROM orders o JOIN order_items oi ON o.order_id = oi.order_id JOIN products p ON oi.product_id = p.product_id JOIN users u ON o.customer_id = u.user_id WHERE p.owner_id = ? GROUP BY o.order_id, o.order_date, o.total_amount, o.status, o.pickup_schedule, u.username, u.first_name, u.last_name ORDER BY o.order_date DESC "); $stmt->execute([$_SESSION['user_id']]); $orders = $stmt->fetchAll(); // For debugging error_log("Orders query result: " . print_r($orders, true)); ?>
Orders for your products will appear here
| Order # | Customer | Items | Date | Total | Status | Pickup | Actions |
|---|---|---|---|---|---|---|---|
| # |
';
// Check if it's a clothing item with size
if (strpos($item, '(Size:') !== false) {
// Split the item into name and size+quantity
$parts = explode(' (Size:', $item);
$name = $parts[0];
$sizeAndQty = $parts[1];
// Split size and quantity
$sizeQtyParts = explode(') x', $sizeAndQty);
$size = $sizeQtyParts[0];
$quantity = $sizeQtyParts[1];
echo '' . htmlspecialchars($name) . '';
echo 'Size: ' . htmlspecialchars($size) . '';
echo 'x' . htmlspecialchars($quantity) . '';
} else {
echo htmlspecialchars($item);
}
echo ' ';
}
?>
|
₱ | Not scheduled | Schedule View |