Podsumowanie zamówienia
| Produkt | Ilość | Cena jedn. | Suma |
|---|---|---|---|
| zł | zł | ||
| Suma: | zł | ||
prepare('SELECT credit_limit, credit_balance, credit_enabled FROM clients WHERE id = ?'); $stmt->execute([$client_id]); $credit_info = $stmt->fetch(PDO::FETCH_ASSOC); } $sql = "SELECT p.id, p.name, p.units_per_pallet, COALESCE(cp.price, p.price_gross) as price FROM products p LEFT JOIN client_prices cp ON p.id = cp.product_id AND cp.client_id = ? WHERE p.id IN ($placeholders)"; $stmt = $pdo->prepare($sql); $params = array_merge([$client_id], $product_ids); $stmt->execute($params); $products = $stmt->fetchAll(PDO::FETCH_ASSOC); $is_supplier_delivery = false; foreach ($products as $product) { $quantity = $cart[$product['id']]; $line_total = $product['price'] * $quantity; $cart_products[] = [ 'id' => $product['id'], 'name' => $product['name'], 'price' => $product['price'], 'quantity' => $quantity, 'line_total' => $line_total, ]; $total_price += $line_total; // Check for full pallets only if units_per_pallet is set and positive if (isset($product['units_per_pallet']) && $product['units_per_pallet'] > 0) { if ($quantity >= $product['units_per_pallet']) { $is_supplier_delivery = true; } } } $delivery_source = $is_supplier_delivery ? 'supplier' : 'cs'; } catch (PDOException $e) { die('Błąd połączenia z bazą danych: ' . $e->getMessage()); } } $page_title = 'Podsumowanie zamówienia'; $user_role = get_user_role(); ?>
| Produkt | Ilość | Cena jedn. | Suma |
|---|---|---|---|
| zł | zł | ||
| Suma: | zł | ||