From ee766351bdd2910a83a3589273bab7cbcc04e64a Mon Sep 17 00:00:00 2001 From: fsst Date: Fri, 6 Mar 2026 14:33:37 +0100 Subject: [PATCH] Monitoring for review overview css and design update --- assets/css/productpage.css | 98 ++++++++++++++++++++++ productpage.php | 162 +++++++++++++++---------------------- 2 files changed, 163 insertions(+), 97 deletions(-) diff --git a/assets/css/productpage.css b/assets/css/productpage.css index 25cce84..7528558 100644 --- a/assets/css/productpage.css +++ b/assets/css/productpage.css @@ -534,4 +534,102 @@ border-radius: 12px; padding: 1rem 1.5rem; color: #94a3b8; +} + + +/* ========================================================== + REVIEW OVERVIEW BOX (Linke Spalte) - Kompakte Version + ========================================================== */ + +.review-overview-box { + background: #1c2533; + border: 1px solid #2a374a; + border-radius: var(--radius-lg); + /* Padding von 1.5rem auf 1rem reduziert für eine kleinere Box */ + padding: 1rem; + margin-top: 1.5rem; + color: #cbd5e1; + animation: fadeInUp 0.5s ease 0.3s both; +} + +.overview-header { + text-align: center; + /* Abstände verringert */ + margin-bottom: 0.8rem; + padding-bottom: 0.8rem; + border-bottom: 1px solid #2a374a; +} + +.overview-avg { + /* Schriftgröße der Durchschnittsnote von 2.5rem auf 2rem verkleinert */ + font-size: 2rem; + font-weight: 700; + color: white; + display: flex; + align-items: center; + justify-content: center; + gap: 0.4rem; +} + +.overview-avg .star { + /* Stern etwas verkleinert */ + font-size: 1.5rem; +} + +.overview-count { + /* Textgröße leicht verkleinert */ + font-size: 0.8rem; + color: #94a3b8; + margin-top: 0.2rem; +} + +.overview-breakdown { + display: flex; + flex-direction: column; + /* Abstand zwischen den Balken verringert */ + gap: 0.4rem; +} + +.breakdown-row { + display: flex; + align-items: center; + gap: 0.5rem; + /* Text bei den Balken etwas kleiner */ + font-size: 0.8rem; +} + +.breakdown-stars { + width: 50px; + white-space: nowrap; + text-align: right; + color: #cbd5e1; +} + +.breakdown-bar-bg { + flex: 1; + /* Höhe der Balken von 8px auf 6px reduziert */ + height: 6px; + background: #2a374a; + border-radius: 3px; + overflow: hidden; +} + +.breakdown-bar-fill { + height: 100%; + background: #fbbf24; + border-radius: 3px; + transition: width 0.8s ease-out; +} + +.breakdown-num { + width: 20px; + text-align: right; + color: #94a3b8; +} + +.overview-empty { + text-align: center; + color: #94a3b8; + padding: 0.5rem 0; + font-size: 0.85rem; } \ No newline at end of file diff --git a/productpage.php b/productpage.php index 3560259..f4193ca 100644 --- a/productpage.php +++ b/productpage.php @@ -129,153 +129,121 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0; bind_param("i", $productId); + $stmtRevOv->execute(); + $resultRevOv = $stmtRevOv->get_result(); - $stmtRevOv->bind_param("i", $productId); - $stmtRevOv->execute(); - $resultRevOv = $stmtRevOv->get_result(); + $reviewOverview = $resultRevOv->fetch_assoc(); - $reviewOverview = $resultRevOv->fetch_assoc(); + // Falls NULL zurückkommt (keine Bewertungen), auf 0 setzen + if ($reviewOverview['reviewCount'] === null) { + $reviewOverview['reviewCount'] = 0; + } ?>
-
- <?= htmlspecialchars($product['model'] ?? 'Produktbild') ?> + <?= htmlspecialchars($product['model'] ?? 'Produktbild') ?>
+ - -
- +
- -
-
- +
- - - - -
-
- - 0): ?> -
- +
+ 0): ?> +
+
+
- -
- Bewertungen +
+ basierend auf Bewertungen
+
-
-
- 5 Sterne: -
- - +
+ (int)$reviewOverview['fiveStarCount'], + 4 => (int)$reviewOverview['fourStarCount'], + 3 => (int)$reviewOverview['threeStarCount'], + 2 => (int)$reviewOverview['twoStarCount'], + 1 => (int)$reviewOverview['oneStarCount'] + ]; + foreach ($starCounts as $stars => $count): + // Prozentwert für den Balken berechnen + $percent = ($reviewOverview['reviewCount'] > 0) ? round(($count / $reviewOverview['reviewCount']) * 100) : 0; + ?> +
+
Sterne
+
+
+
+
-
- 4 Sterne: -
- - - -
-
- 3 Sterne: -
- - - -
-
- 2 Sterne: - -
-
- 1 Stern: -
- - -
- - -
- Noch keine Bewertungen -
- - - - -
- - + +
+ +
+

Noch keine Bewertungen vorhanden.

+
+
-
-

-
- 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 "

"; - } - ?> + 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 "

"; + } + ?>