- First commit to issue fork.
- Assigned to karengrey
- Merge request !6Issue #3170216 Provide option to only add item to Wishlist once. β (Open) created by karengrey
- last update
about 1 year ago 36 pass - Status changed to Needs review
about 1 year ago 5:35pm 31 August 2023 - First commit to issue fork.
- last update
8 months ago 36 pass - πΊπ¦Ukraine marchuk.vitaliy Rivne, UA
vmarchuk β made their first commit to this issueβs fork.
- π§πΎBelarus savage1974
Hi, all
For complete happiness the only thing missing is an update of the wishlist block via Ajax:
In commerce_wishlist.module make some changes:
1. add this row to "commerce_wishlist_add_to_wishlist_form_ajax" function:$response->addCommand(new ReplaceCommand('.wishlist-block', getWishlistBlock()));
2. add 2 functions:
/** * Get wishlist block. * * @return array|NULL * Return render of wishlist block. */ function getWishlistBlock(): ?array { $block_id = getWishlistBlockId(); if ($block_id !== FALSE) { $block = Block::load($block_id); $render = \Drupal::entityTypeManager()->getViewBuilder('block') ->view($block); } return $render ?? NULL; } /** * Gets the machine name of a commerce wishlist block visible on the current page. * * Returns only the first Wishlist found. * * @return string|false * Return id of the first commerce wishlist block found on current page. * Returns FALSE if no commerce wishlist block is visible. */ function getWishlistBlockId(): string|false { // Returns an array of regions each with an array of blocks. $regions = \Drupal::service('block.repository')->getVisibleBlocksPerRegion(); // Iterate all visible blocks and regions. foreach ($regions as $region) { foreach ($region as $block) { $plugin_id = $block->get('plugin'); // Check if this is a commerce wishlist block. if ($plugin_id === 'commerce_wishlist') { return $block->id(); } } } return FALSE; }
- π¨πSwitzerland Lukas von Blarer
luksak β made their first commit to this issueβs fork.
- π¨πSwitzerland Lukas von Blarer
Updating the wishlist block via ajax was accidentally removed in this MR. I just added it back.
Besides that the MR work perfectly for me.