Data zamówienia:
Status:
Metoda płatności:
Suma (brutto): zł
Uwagi:
| Zdjęcie | Produkt | Cena jedn. netto | Cena jedn. brutto | Ilość | Suma (brutto) |
|---|---|---|---|---|---|
| zł | zł | zł |
prepare('SELECT * FROM orders WHERE id = :order_id AND client_id = :client_id'); $stmt->execute([':order_id' => $order_id, ':client_id' => $client_id]); $order = $stmt->fetch(); if (!$order) { $error_message = 'Nie znaleziono zamówienia lub nie masz do niego dostępu.'; } else { $stmt = $pdo->prepare( 'SELECT oi.*, p.name as product_name FROM order_items oi JOIN products p ON oi.product_id = p.id WHERE oi.order_id = ?' ); $stmt->execute([$order_id]); $order_items = $stmt->fetchAll(); if (!empty($order_items)) { $product_ids = array_map(fn($item) => $item['product_id'], $order_items); $placeholders = implode(',', array_fill(0, count($product_ids), '?')); $image_stmt = $pdo->prepare( "SELECT product_id, file_path, is_primary, id FROM product_images WHERE product_id IN ($placeholders) ORDER BY product_id, is_primary DESC, id ASC" ); $image_stmt->execute($product_ids); $images_data = $image_stmt->fetchAll(); $product_images_temp = []; foreach ($images_data as $image) { if (!isset($product_images_temp[$image['product_id']])) { $product_images_temp[$image['product_id']] = 'uploads/products/' . $image['product_id'] . '/' . basename($image['file_path']); } } $product_images = $product_images_temp; } } } catch (PDOException $e) { $error_message = 'Błąd bazy danych. Prosimy spróbować ponownie później.'; error_log($e->getMessage()); } } $page_title = $order ? 'Szczegóły zamówienia #' . $order['id'] : 'Szczegóły zamówienia'; $user_role = get_user_role(); ?>
Data zamówienia:
Status:
Metoda płatności:
Suma (brutto): zł
Uwagi:
| Zdjęcie | Produkt | Cena jedn. netto | Cena jedn. brutto | Ilość | Suma (brutto) |
|---|---|---|---|---|---|
| zł | zł | zł |