Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
wishlist.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
10 ?>
11 <script>
12  require([
13  "Magento_Ui/js/modal/confirm",
14  "prototype",
15  "Magento_Catalog/catalog/product/composite/configure"
16  ], function(confirm){
17 
18 //<!--
19  wishlistControl = {
20  reload: function (urlParams) {
21  if (!urlParams) {
22  urlParams = '';
23  }
24  var url = <?= $block->escapeJs($block->escapeUrl($block->getJsObjectName())) ?>.url + '?ajax=true' + urlParams;
25  new Ajax.Updater(
26  <?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.containerId,
27  url,
28  {
29  parameters: {form_key: FORM_KEY},
30  onComplete: <?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?>.initGrid.bind(<?= $block->escapeJs($block->escapeHtml($block->getJsObjectName())) ?>),
31  evalScripts:true
32  }
33  );
34  },
35 
36  configureItem: function (itemId) {
37  productConfigure.setOnLoadIFrameCallback('wishlist', this.cbOnLoadIframe.bind(this));
38  productConfigure.showItemConfiguration('wishlist', itemId);
39  return false;
40  },
41 
42  cbOnLoadIframe: function (response) {
43  if (!response.ok) {
44  return;
45  }
46  this.reload();
47  },
48 
49  removeItem: function (itemId) {
50  var self = this;
51 
52  confirm({
53  content: '<?= $block->escapeJs($block->escapeHtml(__('Are you sure you want to remove this item?'))) ?>',
54  actions: {
55  confirm: function () {
56  self.reload('&delete=' + itemId);
57  }
58  }
59  });
60  }
61  }
62 
63  productConfigure.addListType(
64  'wishlist',
65  {
66  urlFetch: '<?= $block->escapeJs($block->escapeUrl($block->getUrl('customer/wishlist_product_composite_wishlist/configure'))) ?>',
67  urlConfirm: '<?= $block->escapeJs($block->escapeUrl($block->getUrl('customer/wishlist_product_composite_wishlist/update'))) ?>'
68  }
69  );
70  //-->
71 
72  });
73 </script>
$block
Definition: block.php:8