diff --git a/assets/css/productpage.css b/assets/css/productpage.css new file mode 100644 index 0000000..e69de29 diff --git a/productpage.php b/productpage.php index 0b469c7..f9e240b 100644 --- a/productpage.php +++ b/productpage.php @@ -36,11 +36,30 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0; prepare(" - SELECT productID, model, description, imagePath - FROM products - WHERE productID = ? - LIMIT 1 - "); + SELECT + a.name, + a.unit, + 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->execute(); @@ -49,27 +68,19 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0; $product = $result->fetch_assoc(); ?> - -
-
-
- <?= htmlspecialchars($product['model']) ?> + fetch_assoc()) { + echo "

{$row['name']}: "; + + if (!empty($row['valueString'])) echo $row['valueString']; + if (!empty($row['valueNumber'])) echo $row['valueNumber'] . " " . $row['unit']; + if (!is_null($row['valueBool'])) echo $row['valueBool'] ? "Ja" : "Nein"; + + echo "

"; + } + + ?> -
-

-

-
-
-
-
- -
-

Produkt nicht gefunden

-

Zu dieser ID gibt es kein Produkt.

-
- close(); ?>