product card first design
This commit is contained in:
parent
1ff652509b
commit
9e9b239bca
0
assets/css/productpage.css
Normal file
0
assets/css/productpage.css
Normal file
@ -36,11 +36,30 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php
|
<?php
|
||||||
$stmt = $conn->prepare("
|
$stmt = $conn->prepare("
|
||||||
SELECT productID, model, description, imagePath
|
SELECT
|
||||||
FROM products
|
a.name,
|
||||||
WHERE productID = ?
|
a.unit,
|
||||||
LIMIT 1
|
a.dataType,
|
||||||
");
|
pa.valueString,
|
||||||
|
pa.valueNumber,
|
||||||
|
pa.valueBool
|
||||||
|
FROM products p
|
||||||
|
|
||||||
|
INNER JOIN categoryAttributes ca
|
||||||
|
ON p.categoryID = ca.categoryID
|
||||||
|
|
||||||
|
INNER JOIN attributes a
|
||||||
|
ON ca.attributeID = a.attributeID
|
||||||
|
|
||||||
|
LEFT JOIN productAttributes pa
|
||||||
|
ON pa.productID = p.productID
|
||||||
|
AND pa.attributeID = a.attributeID
|
||||||
|
|
||||||
|
WHERE p.productID = ?
|
||||||
|
|
||||||
|
ORDER BY a.attributeID
|
||||||
|
");
|
||||||
|
|
||||||
|
|
||||||
$stmt->bind_param("i", $productId);
|
$stmt->bind_param("i", $productId);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
@ -49,27 +68,19 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
|||||||
$product = $result->fetch_assoc();
|
$product = $result->fetch_assoc();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ($product): ?>
|
<?php
|
||||||
<section class="product-section">
|
while ($row = $result->fetch_assoc()) {
|
||||||
<div class="product-scroll">
|
echo "<p><strong>{$row['name']}:</strong> ";
|
||||||
<div class="product-card">
|
|
||||||
<img
|
if (!empty($row['valueString'])) echo $row['valueString'];
|
||||||
src="<?= isset($product['imagePath']) ? $product['imagePath'] : 'assets/images/placeholder.png' ?>"
|
if (!empty($row['valueNumber'])) echo $row['valueNumber'] . " " . $row['unit'];
|
||||||
alt="<?= htmlspecialchars($product['model']) ?>">
|
if (!is_null($row['valueBool'])) echo $row['valueBool'] ? "Ja" : "Nein";
|
||||||
|
|
||||||
|
echo "</p>";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="product-card__content">
|
|
||||||
<h3><?= htmlspecialchars($product['model']) ?></h3>
|
|
||||||
<p><?= htmlspecialchars($product['description']) ?></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
<?php else: ?>
|
|
||||||
<section class="product-section">
|
|
||||||
<h2>Produkt nicht gefunden</h2>
|
|
||||||
<p>Zu dieser ID gibt es kein Produkt.</p>
|
|
||||||
</section>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php $stmt->close(); ?>
|
<?php $stmt->close(); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user