wunschlisten button V1.0

This commit is contained in:
Paul Eisenbock 2026-02-18 16:21:59 +01:00
parent 843660c8c9
commit 59e2a6f46d

View File

@ -33,6 +33,7 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
<h2>Produkt nicht gefunden</h2> <h2>Produkt nicht gefunden</h2>
<p>Bitte eine gueltige Produkt-ID mitgeben.</p> <p>Bitte eine gueltige Produkt-ID mitgeben.</p>
</section> </section>
<?php else: ?> <?php else: ?>
<?php <?php
$stmt = $conn->prepare(" $stmt = $conn->prepare("
@ -71,6 +72,11 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
$product = $result->fetch_assoc(); $product = $result->fetch_assoc();
?> ?>
<?php
$alreadyInWishlist = false;
?>
<div class="product-wrapper"> <div class="product-wrapper">
<!-- LINKER BEREICH BILD --> <!-- LINKER BEREICH BILD -->
<div class="product-left"> <div class="product-left">
@ -79,6 +85,43 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
src="<?= isset($product['imagePath']) ? $product['imagePath'] : 'assets/images/placeholder.png' ?>" src="<?= isset($product['imagePath']) ? $product['imagePath'] : 'assets/images/placeholder.png' ?>"
alt="<?= htmlspecialchars($product['model'] ?? 'Produktbild') ?>"> alt="<?= htmlspecialchars($product['model'] ?? 'Produktbild') ?>">
</div> </div>
<?php if (isset($_SESSION['user_id'])): ?>
<?php if ($alreadyInWishlist): ?>
<div class="auth__actions">
<input class="auth__submit" type="button"
value="Bereits in Wunschliste"
disabled>
</div>
<?php else: ?>
<form method="POST">
<input type="hidden" name="product_id" value="<?= (int)$productId ?>">
<input type="hidden" name="add_wishlist" value="1">
<div class="auth__actions">
<input class="auth__submit"
type="submit"
value="Zur Wunschliste hinzufügen">
</div>
</form>
<?php endif; ?>
<?php else: ?>
<div class="auth__actions">
<a href="login.php">
<input class="auth__submit" type="button"
value="Zum Hinzufügen einloggen">
</a>
</div>
<?php endif; ?>
</div> </div>
<!-- RECHTER BEREICH DETAILS --> <!-- RECHTER BEREICH DETAILS -->
@ -110,7 +153,7 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
</div> </div>
</div> </div>
</div> </div>
<div class ="shop-offers"
<?php $stmt->close(); ?> <?php $stmt->close(); ?>
<?php endif; ?> <?php endif; ?>