prepare('SELECT order_id FROM order_items WHERE id = ?'); $stmt_get_order->execute([$order_item_id]); $order_id = $stmt_get_order->fetchColumn(); if ($order_id) { $stmt = db()->prepare( 'UPDATE order_items oi JOIN products p ON oi.product_id = p.id SET oi.item_status = ? WHERE oi.id = ? AND p.supplier_id = ?' ); $stmt->execute([$item_status, $order_item_id, $supplier_id]); update_order_status($order_id); } header('Location: /supplier/order_items.php'); exit; } $stmt = db()->prepare( 'SELECT oi.id AS order_item_id, o.id AS order_id, p.name AS product_name, oi.quantity, oi.item_status, oi.updated_at FROM order_items oi JOIN orders o ON oi.order_id = o.id JOIN products p ON oi.product_id = p.id WHERE p.supplier_id = ? ORDER BY o.created_at DESC' ); $stmt->execute([$supplier_id]); $order_items = $stmt->fetchAll(); $item_statuses = ['pending', 'in_progress', 'shipped']; $pageTitle = t('my_order_items'); require_once __DIR__ . '/../includes/html_head.php'; require_once __DIR__ . '/../includes/header.php'; ?>