Review Overview start
This commit is contained in:
parent
ae42dc597a
commit
83081b988e
@ -127,6 +127,25 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
$stmtRevOv = mysqli_prepare($conn,
|
||||
"SELECT AVG(rating) as avgRating, COUNT(*) as reviewCount,
|
||||
COUNT(rating = 5 ) as fiveStarCount,
|
||||
COUNT(rating = 4 ) as fourStarCount,
|
||||
COUNT(rating = 3 ) as threeStarCount,
|
||||
COUNT(rating = 2 ) as twoStarCount,
|
||||
COUNT(rating = 1 ) as oneStarCount
|
||||
FROM reviews WHERE productID = ?");
|
||||
|
||||
$stmtRevOv->bind_param("i", $productId);
|
||||
$stmtRevOv->execute();
|
||||
$resultRevOv = $stmtRevOv->get_result();
|
||||
|
||||
$reviewOverview = $resultRevOv->fetch_assoc();
|
||||
?>
|
||||
|
||||
<div class="product-wrapper">
|
||||
<!-- LINKER BEREICH – BILD -->
|
||||
<div class="product-left">
|
||||
@ -171,7 +190,64 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="review-over">
|
||||
<div class="review-rating">
|
||||
|
||||
<?php if ($reviewOverview['reviewCount'] > 0): ?>
|
||||
<div class="avg-rating">
|
||||
<?= htmlspecialchars($reviewOverview['avgRating']) ?>
|
||||
</div>
|
||||
|
||||
<div class="review-count">
|
||||
<?= htmlspecialchars($reviewOverview['reviewCount']) ?> Bewertungen
|
||||
</div>
|
||||
|
||||
<div class="review-breakdown">
|
||||
<div class="five-star">
|
||||
5 Sterne: <?= htmlspecialchars($reviewOverview['fiveStarCount']) ?>
|
||||
<div class="star-rating">
|
||||
<?php $i = 5?>
|
||||
<span class="star <?= $i,'filled' ?>">★</span>
|
||||
|
||||
</div>
|
||||
<div class="four-star">
|
||||
4 Sterne: <?= htmlspecialchars($reviewOverview['fourStarCount']) ?>
|
||||
<div class="star-rating">
|
||||
<?php $i = 4?>
|
||||
<span class="star <?= $i,'filled' ?>">★</span>
|
||||
|
||||
</div>
|
||||
<div class="three-star">
|
||||
3 Sterne: <?= htmlspecialchars($reviewOverview['threeStarCount']) ?>
|
||||
<div class="star-rating">
|
||||
<?php $i = 3?>
|
||||
<span class="star <?= $i,'filled' ?>">★</span>
|
||||
|
||||
</div>
|
||||
<div class="two-star">
|
||||
2 Sterne: <?= htmlspecialchars($reviewOverview['twoStarCount']) ?>
|
||||
|
||||
</div>
|
||||
<div class="one-star">
|
||||
1 Stern: <?= htmlspecialchars($reviewOverview['oneStarCount']) ?>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<?php else: ?>
|
||||
<div class="no-rating">
|
||||
Noch keine Bewertungen
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RECHTER BEREICH – DETAILS -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user