prepare(" SELECT productID, model, description, imagePath FROM products WHERE model LIKE ? OR description LIKE ? ORDER BY model ASC LIMIT 60 "); if ($stmtSearch) { $stmtSearch->bind_param('ss', $like, $like); $stmtSearch->execute(); $resultSearch = $stmtSearch->get_result(); ?>

Suchergebnisse für „

num_rows <= 0): ?>

Keine Produkte gefunden.

fetch_assoc()): ?> <?= htmlspecialchars($product['model'] ?? '') ?>

close(); } // Wichtig: In Suchmodus KEINE Kategorien rendern. return; } ?> ['id' => 20, 'label' => 'iPhone'], 'ipad' => ['id' => 21, 'label' => 'iPad'], 'macbook' => ['id' => 22, 'label' => 'MacBook'], 'airpods' => ['id' => 23, 'label' => 'AirPods'], 'accessories' => ['id' => 24, 'label' => 'Accessories'], ]; ?> $cat): ?> $v) { if ($v !== '' && strpos($k, 'attr_') === 0) { $attrId = (int)substr($k, 5); $attrAlias = "pa" . $attrIndex; $baseQuery .= " JOIN productAttributes $attrAlias ON p.productID = $attrAlias.productID "; // Assume string or number comparison. For simplicity, check string or number. // In DB, valueString, valueNumber, valueBool can be checked. $whereClauses[] = "($attrAlias.attributeID = ? AND ($attrAlias.valueString = ? OR $attrAlias.valueNumber = ? OR ($attrAlias.valueBool = 1 AND ? = 'Ja') OR ($attrAlias.valueBool = 0 AND ? = 'Nein')))"; $params[] = $attrId; $params[] = $v; $params[] = is_numeric($v) ? (float)$v : 0; $params[] = $v; $params[] = $v; $types .= "isdss"; $attrIndex++; } } $sql = $baseQuery . " WHERE " . implode(" AND ", $whereClauses); $stmt = $conn->prepare($sql); $stmt->bind_param($types, ...$params); $stmt->execute(); $result = $stmt->get_result(); ?> num_rows > 0): ?>

fetch_assoc()): ?> <?= htmlspecialchars($product['model']) ?>

close(); ?>