diff --git a/compare.php b/compare.php
new file mode 100644
index 0000000..64ae1b0
--- /dev/null
+++ b/compare.php
@@ -0,0 +1,159 @@
+ &$prodList) {
+ $key = array_search($removeId, $prodList);
+ if ($key !== false) {
+ unset($prodList[$key]);
+ }
+ }
+ unset($prodList);
+ }
+}
+?>
+
+
+
Produktvergleich
+
+ $productIds) {
+ if (empty($productIds)) continue;
+ $hasProducts = true;
+
+ // Kategorie-Namen holen
+ $catName = "Kategorie $categoryId";
+ $stmtCat = $conn->prepare("SELECT name FROM categories WHERE categoryID = ?");
+ if ($stmtCat) {
+ $stmtCat->bind_param("i", $categoryId);
+ $stmtCat->execute();
+ $resCat = $stmtCat->get_result();
+ if ($row = $resCat->fetch_assoc()) {
+ $catName = $row['name'];
+ }
+ $stmtCat->close();
+ }
+
+ // Attribute der Kategorie holen
+ $attributes = [];
+ $stmtAttr = $conn->prepare("
+ SELECT a.attributeID, a.name, a.unit, a.dataType
+ FROM categoryAttributes ca
+ JOIN attributes a ON ca.attributeID = a.attributeID
+ WHERE ca.categoryID = ?
+ ORDER BY a.attributeID
+ ");
+ if ($stmtAttr) {
+ $stmtAttr->bind_param("i", $categoryId);
+ $stmtAttr->execute();
+ $resAttr = $stmtAttr->get_result();
+ while ($row = $resAttr->fetch_assoc()) {
+ $attributes[$row['attributeID']] = $row;
+ }
+ $stmtAttr->close();
+ }
+
+ // Produktdaten holen
+ $products = [];
+ $idList = implode(',', array_map('intval', $productIds));
+ $stmtProd = $conn->query("SELECT productID, model, imagePath, description FROM products WHERE productID IN ($idList)");
+ if ($stmtProd) {
+ while ($row = $stmtProd->fetch_assoc()) {
+ $products[$row['productID']] = $row;
+ }
+ }
+
+ // Produktattribute holen
+ $productAttrVals = [];
+ $stmtProdAttr = $conn->query("SELECT productID, attributeID, valueString, valueNumber, valueBool FROM productAttributes WHERE productID IN ($idList)");
+ if ($stmtProdAttr) {
+ while ($row = $stmtProdAttr->fetch_assoc()) {
+ $productAttrVals[$row['productID']][$row['attributeID']] = $row;
+ }
+ }
+ ?>
+
+
= htmlspecialchars($catName) ?>
+
+
+
+
+
+ | Eigenschaft |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+ | Beschreibung |
+
+
+
+ = htmlspecialchars($products[$pId]['description']) ?>
+ |
+
+
+ $attr): ?>
+
+ | = htmlspecialchars($attr['name']) ?> |
+
+
+
+
+ |
+
+
+
+
+
+
+ Du hast noch keine Produkte zum Vergleich hinzugefügt. Gehe auf eine Produktseite, um Produkte hinzuzufügen.";
+ }
+ ?>
+
+
+
diff --git a/header.php b/header.php
index d774274..627bd80 100644
--- a/header.php
+++ b/header.php
@@ -75,6 +75,9 @@