From 4a56be73f9fbb37817fe80ff08496665c3cf77d4 Mon Sep 17 00:00:00 2001 From: Jay Trees Date: Mon, 17 Jan 2022 14:18:01 +0100 Subject: [PATCH] Add wishlist delete button --- includes/assets/js/wishlist-view.js | 7 +++++++ includes/pages/wishlist-view.php | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 includes/assets/js/wishlist-view.js diff --git a/includes/assets/js/wishlist-view.js b/includes/assets/js/wishlist-view.js new file mode 100644 index 00000000..4231b028 --- /dev/null +++ b/includes/assets/js/wishlist-view.js @@ -0,0 +1,7 @@ +$(function() { + $('.ui.dropdown.wishlists').on('change', function() { + $('[name="wishlist_delete_id"]').val( + $('.ui.dropdown.wishlists').dropdown('get value') + ); + }); +}); diff --git a/includes/pages/wishlist-view.php b/includes/pages/wishlist-view.php index a8d32b4f..7e5cc3ee 100644 --- a/includes/pages/wishlist-view.php +++ b/includes/pages/wishlist-view.php @@ -20,6 +20,15 @@ if (isset($_GET['wishlist'])) { $wishlist = $_GET['wishlist']; $products = $user->getProducts($wishlist); } + +/** + * Delete wishlist + */ +if (isset($_POST['wishlist_delete_id'])) { + $database->query('DELETE FROM `wishlists` + WHERE id = ' . $_POST['wishlist_delete_id'] . ' + ;'); +} ?>
@@ -49,6 +58,15 @@ if (isset($_GET['wishlist'])) { Share + +
+ + + +