Add wishlist delete button
This commit is contained in:
parent
24f592f954
commit
4a56be73f9
2 changed files with 25 additions and 0 deletions
7
includes/assets/js/wishlist-view.js
Normal file
7
includes/assets/js/wishlist-view.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
$(function() {
|
||||
$('.ui.dropdown.wishlists').on('change', function() {
|
||||
$('[name="wishlist_delete_id"]').val(
|
||||
$('.ui.dropdown.wishlists').dropdown('get value')
|
||||
);
|
||||
});
|
||||
});
|
|
@ -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'] . '
|
||||
;');
|
||||
}
|
||||
?>
|
||||
<main>
|
||||
<div class="ui container">
|
||||
|
@ -49,6 +58,15 @@ if (isset($_GET['wishlist'])) {
|
|||
<i class="share icon"></i>
|
||||
Share
|
||||
</button>
|
||||
|
||||
<form class="ui form" method="post">
|
||||
<input type="hidden" name="wishlist_delete_id" />
|
||||
|
||||
<button class="ui small labeled red icon button" type="submit">
|
||||
<i class="trash icon"></i>
|
||||
Delete
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in a new issue