Revamp advertisement section with enhanced styling, dynamic pricing, and urgency messaging

This commit is contained in:
Fabian Schieder 2026-03-30 23:53:33 +02:00
parent 3d5252ad12
commit 38930d7766

View File

@ -8,132 +8,262 @@ $result = $conn->query($query);
$adProduct = $result->fetch_assoc();
if ($adProduct):
$fakeOldPrice = rand(199, 599) . ",00 €";
$fakeNewPrice = rand(19, 49) . ",99 €";
$fakeStock = rand(2, 5);
?>
<style>
.ad-recommendation {
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
border-radius: 12px;
padding: 20px;
margin: 20px auto;
max-width: 1200px;
background: linear-gradient(45deg, #ff0000, #ff8c00, #ff007f);
background-size: 600% 600%;
animation: gradientShift 5s ease infinite;
padding: 60px 20px;
margin: 40px 0;
width: 100vw;
position: relative;
left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
display: flex;
justify-content: center;
color: #fff;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
overflow: hidden;
}
@keyframes gradientShift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
.ad-recommendation::before {
content: 'ANZEIGE - GESPONSERT';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
background: rgba(0,0,0,0.8);
color: #ffd700;
padding: 4px 20px;
font-size: 0.8rem;
font-weight: 900;
text-transform: uppercase;
letter-spacing: 3px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.ad-container {
max-width: 1400px;
width: 100%;
display: flex;
align-items: center;
gap: 20px;
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
position: relative;
overflow: hidden;
color: #333;
}
.ad-recommendation::before {
content: 'Anzeige';
position: absolute;
top: 10px;
right: 15px;
font-size: 0.8rem;
background: rgba(255,255,255,0.7);
padding: 2px 8px;
border-radius: 4px;
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
gap: 50px;
}
.ad-image-container {
flex-shrink: 0;
width: 200px;
height: 200px;
background: #fff;
border-radius: 8px;
width: 350px;
height: 350px;
background: radial-gradient(circle, #fff 0%, #ffe6e6 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
padding: 10px;
box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
padding: 20px;
box-shadow: 0 0 50px rgba(255, 255, 255, 0.4), inset 0 0 20px rgba(0,0,0,0.1);
border: 8px solid #ffd700;
transform: rotate(-5deg);
animation: floating 3s ease-in-out infinite;
}
@keyframes floating {
0% { transform: translateY(0px) rotate(-5deg); }
50% { transform: translateY(-15px) rotate(-2deg); }
100% { transform: translateY(0px) rotate(-5deg); }
}
.ad-image-container img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
filter: drop-shadow(0 10px 10px rgba(0,0,0,0.3));
}
.ad-content {
flex-grow: 1;
}
.ad-tag {
display: inline-block;
background: #ff4757;
color: white;
padding: 5px 12px;
border-radius: 20px;
font-weight: bold;
font-size: 0.9rem;
margin-bottom: 10px;
box-shadow: 0 4px 6px rgba(255, 71, 87, 0.3);
}
.ad-title {
font-size: 1.8rem;
font-weight: 800;
margin: 0 0 10px 0;
line-height: 1.2;
}
.ad-description {
font-size: 1rem;
line-height: 1.5;
margin-bottom: 20px;
opacity: 0.9;
max-width: 600px;
}
.ad-btn {
display: inline-block;
background: #2ed573;
color: white;
text-decoration: none;
padding: 12px 24px;
background: #ffd700;
color: #d10000;
padding: 8px 20px;
border-radius: 30px;
font-weight: bold;
font-size: 1.1rem;
transition: transform 0.2s, box-shadow 0.2s;
box-shadow: 0 4px 6px rgba(46, 213, 115, 0.3);
}
.ad-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(46, 213, 115, 0.4);
color: white;
font-weight: 900;
font-size: 1.2rem;
margin-bottom: 15px;
text-transform: uppercase;
animation: pulseTag 1s infinite alternate;
box-shadow: 0 0 15px #ffd700;
}
@media (max-width: 768px) {
.ad-recommendation {
@keyframes pulseTag {
0% { transform: scale(1); }
100% { transform: scale(1.1); }
}
.ad-title {
font-size: 3.5rem;
font-weight: 900;
margin: 0 0 15px 0;
line-height: 1.1;
text-shadow: 3px 3px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
text-transform: uppercase;
}
.ad-stars {
color: #ffd700;
font-size: 1.5rem;
margin-bottom: 15px;
text-shadow: 1px 1px 2px #000;
}
.ad-prices {
display: flex;
align-items: baseline;
gap: 15px;
margin-bottom: 20px;
}
.ad-old-price {
font-size: 1.5rem;
text-decoration: line-through;
color: #ffcccc;
font-weight: bold;
}
.ad-new-price {
font-size: 3rem;
font-weight: 900;
color: #ffd700;
text-shadow: 2px 2px 4px #000;
animation: flashPrice 2s infinite;
}
@keyframes flashPrice {
0%, 100% { color: #ffd700; }
50% { color: #fff; text-shadow: 0 0 20px #ffd700, 2px 2px 4px #000; }
}
.ad-description {
font-size: 1.2rem;
line-height: 1.6;
margin-bottom: 25px;
font-weight: bold;
text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
background: rgba(0,0,0,0.3);
padding: 15px;
border-left: 5px solid #ffd700;
border-radius: 0 10px 10px 0;
max-width: 800px;
}
.ad-urgency {
font-size: 1.2rem;
font-weight: 900;
color: #fff;
background: #d10000;
display: inline-block;
padding: 10px 20px;
border-radius: 5px;
margin-bottom: 25px;
border: 2px solid #fff;
box-shadow: 0 0 15px rgba(209,0,0,0.8);
}
.ad-btn {
display: inline-block;
background: linear-gradient(to bottom, #ffd700, #ff8c00);
color: #000;
text-decoration: none;
padding: 20px 50px;
border-radius: 50px;
font-weight: 900;
font-size: 1.8rem;
text-transform: uppercase;
transition: all 0.2s;
box-shadow: 0 10px 20px rgba(0,0,0,0.4), inset 0 -4px 0 rgba(0,0,0,0.2);
border: 4px solid #fff;
animation: heartbeat 1.5s infinite;
}
.ad-btn:hover {
transform: scale(1.1);
box-shadow: 0 15px 30px rgba(0,0,0,0.6), inset 0 -4px 0 rgba(0,0,0,0.2);
color: #000;
}
@keyframes heartbeat {
0% { transform: scale(1); }
15% { transform: scale(1.05); }
30% { transform: scale(1); }
45% { transform: scale(1.05); }
60% { transform: scale(1); }
}
@media (max-width: 900px) {
.ad-container {
flex-direction: column;
text-align: center;
padding: 30px 15px;
}
.ad-image-container {
width: 100%;
max-width: 250px;
}
.ad-title {
font-size: 1.5rem;
}
.ad-title { font-size: 2.2rem; }
.ad-description { border-left: none; border-top: 5px solid #ffd700; border-radius: 0 0 10px 10px; }
.ad-prices { justify-content: center; }
}
</style>
<div class="ad-recommendation">
<div class="ad-image-container">
<img src="<?= htmlspecialchars($adProduct['imagePath']) ?>" alt="<?= htmlspecialchars($adProduct['model']) ?>">
</div>
<div class="ad-content">
<div class="ad-tag">🔥 Empfehlung des Tages</div>
<h2 class="ad-title"><?= htmlspecialchars($adProduct['model']) ?></h2>
<p class="ad-description">
<?php
$desc = $adProduct['description'];
if (function_exists('mb_strimwidth')) {
$desc = mb_strimwidth($desc, 0, 150, "...");
} else {
$desc = strlen($desc) > 150 ? substr($desc, 0, 147) . "..." : $desc;
}
echo htmlspecialchars($desc);
?>
</p>
<a href="productpage.php?id=<?= $adProduct['productID'] ?>" class="ad-btn">Jetzt entdecken</a>
<div class="ad-container">
<div class="ad-image-container">
<img src="<?= htmlspecialchars($adProduct['imagePath']) ?>" alt="<?= htmlspecialchars($adProduct['model']) ?>">
</div>
<div class="ad-content">
<div class="ad-tag">🔥 WAHNSINNS-DEAL DES TAGES 🔥</div>
<h2 class="ad-title"><?= htmlspecialchars($adProduct['model']) ?></h2>
<div class="ad-stars">
★★★★★ <span style="font-size:1rem; color:#fff; font-weight:normal; text-shadow:none;">(4.987 Bewertungen)</span>
</div>
<div class="ad-prices">
<span class="ad-old-price">Statt <?= $fakeOldPrice ?></span>
<span class="ad-new-price">JETZT NUR <?= $fakeNewPrice ?>!</span>
</div>
<p class="ad-description">
UNFASSBAR! Dieser unglaubliche Bestseller geht gerade viral und sprengt alle Erwartungen!
Greif jetzt zu, bevor es zu spät ist!
<?php
$desc = $adProduct['description'];
if (function_exists('mb_strimwidth')) {
$desc = mb_strimwidth($desc, 0, 100, "...");
} else {
$desc = strlen($desc) > 100 ? substr($desc, 0, 97) . "..." : $desc;
}
echo htmlspecialchars($desc);
?>
</p>
<div class="ad-urgency">
ACHTUNG: Nur noch <?= $fakeStock ?> Stück auf Lager! Andere Nutzer schauen sich diesen Artikel gerade an!
</div>
<br>
<a href="productpage.php?id=<?= $adProduct['productID'] ?>" class="ad-btn">👉 SOFORT ZUSCHLAGEN 👈</a>
</div>
</div>
</div>
<?php endif; ?>