Add minimum price display to advertisement recommendations in ad_recommendation.php
This commit is contained in:
parent
c10f5f52ed
commit
420d68c52a
@ -4,8 +4,10 @@ require_once __DIR__ . '/lib/bootstrap.php';
|
||||
$conn = db_connect();
|
||||
|
||||
$stmt = $conn->query("
|
||||
SELECT productID, model, description, imagePath
|
||||
FROM products
|
||||
SELECT p.productID, p.model, p.description, p.imagePath, MIN(o.price) as minPrice
|
||||
FROM products p
|
||||
LEFT JOIN offers o ON p.productID = o.productID
|
||||
GROUP BY p.productID
|
||||
ORDER BY RAND()
|
||||
LIMIT 1
|
||||
");
|
||||
@ -16,6 +18,8 @@ if ($stmt && $stmt->num_rows > 0) {
|
||||
$rModel = htmlspecialchars($randomProduct['model'] ?? '');
|
||||
$rDesc = htmlspecialchars($randomProduct['description'] ?? '');
|
||||
$rImg = htmlspecialchars($randomProduct['imagePath'] ?? 'assets/images/placeholder.png');
|
||||
$rPriceRaw = $randomProduct['minPrice'];
|
||||
$rPriceFormatted = $rPriceRaw ? number_format((float)$rPriceRaw, 2, ',', '.') : '100,00';
|
||||
?>
|
||||
<style>
|
||||
/* Catchy Full-Width Recommendation Ad - Fully Embedded */
|
||||
@ -81,11 +85,23 @@ if ($stmt && $stmt->num_rows > 0) {
|
||||
.ad-recommendation__content h2 {
|
||||
font-size: 3rem;
|
||||
font-weight: 900;
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 0.5rem;
|
||||
color: #ffffff;
|
||||
text-shadow: 0 4px 10px rgba(0,0,0,0.2);
|
||||
line-height: 1.1;
|
||||
}
|
||||
.ad-recommendation__price {
|
||||
font-size: 2.2rem;
|
||||
font-weight: 900;
|
||||
color: #ffeb3b;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
||||
display: inline-block;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
padding: 0.2rem 1rem;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.1);
|
||||
}
|
||||
.ad-recommendation__content p {
|
||||
font-size: 1.2rem;
|
||||
color: rgba(255, 255, 255, 0.95);
|
||||
@ -157,6 +173,7 @@ if ($stmt && $stmt->num_rows > 0) {
|
||||
<div class="ad-recommendation__content">
|
||||
<span class="ad-recommendation__badge">Empfehlung des Tages</span>
|
||||
<h2><?= $rModel ?></h2>
|
||||
<div class="ad-recommendation__price">ab <?= $rPriceFormatted ?> €</div>
|
||||
<?php
|
||||
$descLen = function_exists('mb_strlen') ? mb_strlen($rDesc) : strlen($rDesc);
|
||||
$descShort = $descLen > 120 ? (function_exists('mb_substr') ? mb_substr($rDesc, 0, 120) : substr($rDesc, 0, 120)) . '...' : $rDesc;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user