From d9ac63b6473dd449d534e6c7746d7a23c1ba024c Mon Sep 17 00:00:00 2001 From: paul Date: Mon, 30 Mar 2026 20:29:10 +0200 Subject: [PATCH] Implement wishlist functionality: add and remove items from userFavorites --- productpage.php | 68 ++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/productpage.php b/productpage.php index 47af509..a900568 100644 --- a/productpage.php +++ b/productpage.php @@ -94,36 +94,36 @@ if ($checkResult->num_rows === 0) { } ?> - + // FALL 2: Von der Wunschliste entfernen (NEU) + elseif (isset($_POST['remove_wishlist']) && $alreadyInWishlist) { + $stmtDel = mysqli_prepare($conn, "DELETE FROM userFavorites WHERE productID = ? AND userID = ?"); + if ($stmtDel) { + mysqli_stmt_bind_param($stmtDel, 'ii', $productId, $_SESSION['user_id']); + mysqli_stmt_execute($stmtDel); + mysqli_stmt_close($stmtDel); + + // Status aktualisieren, damit gleich wieder der "Hinzufügen"-Button erscheint + $alreadyInWishlist = false; + } + } +} +?> num_rows === 0) { -
- -
+ +
+ + + +
+ +
+
+ +
@@ -170,7 +178,9 @@ if ($checkResult->num_rows === 0) {
+ +