'1') $product_ids = array_map(function($id) { return (int)explode('-', $id)[0]; }, $cart_item_ids); if (!empty($product_ids)) { $placeholders = implode(',', array_fill(0, count($product_ids), '?')); try { $pdo = db(); $stmt = $pdo->prepare("SELECT id, name, price, image_url FROM products WHERE id IN ($placeholders)"); $stmt->execute(array_unique($product_ids)); $products_data = $stmt->fetchAll(PDO::FETCH_ASSOC | PDO::FETCH_UNIQUE); foreach ($_SESSION['cart'] as $cart_item_id => $item) { $product_id = (int)explode('-', $cart_item_id)[0]; if (isset($products_data[$product_id])) { $product = $products_data[$product_id]; $quantity = $item['quantity']; $color = $item['color']; $subtotal = $product['price'] * $quantity; $total_price += $subtotal; $cart_items_detailed[] = [ 'cart_item_id' => $cart_item_id, 'product_id' => $product_id, 'name' => $product['name'], 'price' => $product['price'], 'image_url' => $product['image_url'], 'quantity' => $quantity, 'color' => $color, 'subtotal' => $subtotal ]; } } } catch (PDOException $e) { error_log("DB Error: " . $e->getMessage()); $cart_items_detailed = []; $total_price = 0; } } } $page_title = 'سبد خرید'; include 'includes/header.php'; ?>

سبد خرید شما

سبد خرید شما خالی است.

بازگشت به فروشگاه
محصول قیمت تعداد جمع کل حذف
<?php echo htmlspecialchars($item['name']); ?>
رنگ:
×

جمع نهایی: تومان

ادامه جهت تسویه حساب