diff --git a/assets/css/productpage.css b/assets/css/productpage.css index 20b2d4c..c733955 100644 --- a/assets/css/productpage.css +++ b/assets/css/productpage.css @@ -125,9 +125,8 @@ S .shop-left { display: flex; align-items: center; - gap: 16px; + gap: 28px; /* vorher ~18px */ } - .shop-logo { display: flex; align-items: center; @@ -152,12 +151,13 @@ S } .shop-middle { - display: flex; /* statt column */ + display: flex; align-items: center; - gap: 30px; /* Abstand zwischen Preis / Versand / Lager */ - color: #cbd5e1; + gap: 55px; /* vorher ~35px → jetzt deutlich mehr Abstand */ font-size: 14px; + color: #cbd5e1; } + .shop-shipping { display: flex; flex-direction: column; @@ -184,6 +184,7 @@ S } .shop-price { + margin-left: auto; font-size: 18px; /* kleiner als vorher */ font-weight: 700; color: #4ade80; diff --git a/assets/images/shopLogo/Dummie.png b/assets/images/shopLogo/Dummie.png new file mode 100644 index 0000000..ce825f4 Binary files /dev/null and b/assets/images/shopLogo/Dummie.png differ diff --git a/productpage.php b/productpage.php index e9fb594..bef5bf7 100644 --- a/productpage.php +++ b/productpage.php @@ -70,36 +70,67 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0; $result = $stmt->get_result(); $product = $result->fetch_assoc(); + + $alreadyInWishlist = false; + + if (isset($_SESSION['user_id'])) { + + $stmtCheck = mysqli_prepare( + $conn, + "SELECT 1 FROM userFavorites + WHERE userID = ? AND productID = ? + LIMIT 1" + ); + + if ($stmtCheck) { + mysqli_stmt_bind_param( + $stmtCheck, + "ii", + $_SESSION['user_id'], + $productId + ); + + mysqli_stmt_execute($stmtCheck); + mysqli_stmt_store_result($stmtCheck); + + if (mysqli_stmt_num_rows($stmtCheck) > 0) { + $alreadyInWishlist = true; + } + + mysqli_stmt_close($stmtCheck); + } + } ?> 0 && $alreadyInWishlist == null) { + if (!$alreadyInWishlist) { $stmtFav = mysqli_prepare( $conn, - "INSERT IGNORE INTO userFavorites (productID, userID) VALUES (?, ?)" + "INSERT INTO userFavorites (productID, userID) VALUES (?, ?)" ); if ($stmtFav) { - mysqli_stmt_bind_param($stmtFav, 'ii', $productIdPost, $userId); + mysqli_stmt_bind_param( + $stmtFav, + 'ii', + $productId, + $_SESSION['user_id'] + ); + mysqli_stmt_execute($stmtFav); mysqli_stmt_close($stmtFav); + $alreadyInWishlist = true; } } } - ?>
@@ -222,7 +253,7 @@ $productId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
- Versand: € + Versand: €       Lieferzeit: Werktage
diff --git a/wunschliste.php b/wunschliste.php index 4362e97..fb56133 100644 --- a/wunschliste.php +++ b/wunschliste.php @@ -24,35 +24,21 @@ if (!$conn) } ?> - - - ['id' => 20, 'label' => 'iPhone'], - 'ipad' => ['id' => 21, 'label' => 'iPad'], - 'macbook' => ['id' => 22, 'label' => 'MacBook'], - 'airpods' => ['id' => 23, 'label' => 'AirPods'], - 'accessories' => ['id' => 24, 'label' => 'Accessories'], -]; -?> - - - - - $cat): ?> - - + prepare(" - SELECT productID, model, description, imagePath - FROM products - WHERE categoryID = ? + SELECT products.productID, products.model, products.description, products.imagePath + FROM userFavorites INNER JOIN products ON userFavorites.productID = products.productID + WHERE userID = ? "); - $stmt->bind_param("i", $cat['id']); // i = integer + $stmt->bind_param("i", $_SESSION['user_id']); $stmt->execute(); $result = $stmt->get_result(); @@ -60,7 +46,6 @@ $categories = [ num_rows > 0): ?>
-

fetch_assoc()): ?> @@ -82,10 +67,6 @@ $categories = [ close(); ?> - - - -