Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
popup.phtml
Go to the documentation of this file.
1 <?php
7 // @codingStandardsIgnoreFile
8 
9 ?>
10 <?php ?>
11 <?php
12 $shippingMethod = $block->getShipment()->getOrder()->getShippingMethod();
13 $sizeSource = $block->getSourceSizeModel()->toOptionArray();
14 $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 : 0;
15 ?>
16 <script>
17  require([
18  "jquery",
19  "prototype",
20  "Magento_Shipping/order/packaging",
21  "Magento_Ui/js/modal/modal"
22  ], function(jQuery){
23 
24  window.packaging = new Packaging(<?= /* @escapeNotVerified */ $block->getConfigDataJson() ?>);
25  packaging.changeContainerType($$('select[name=package_container]')[0]);
26  packaging.checkSizeAndGirthParameter(
27  $$('select[name=package_container]')[0],
28  <?= /* @escapeNotVerified */ $girthEnabled ?>
29  );
30  packaging.setConfirmPackagingCallback(function(){
31  packaging.setParamsCreateLabelRequest($('edit_form').serialize(true));
32  packaging.sendCreateLabelRequest();
33  });
34  packaging.setLabelCreatedCallback(function(response){
35  setLocation("<?php /* @escapeNotVerified */ echo $block->getUrl(
36  'sales/order/view',
37  ['order_id' => $block->getShipment()->getOrderId()]
38  ); ?>");
39  });
40  packaging.setCancelCallback(function() {
41  if ($('create_shipping_label')) {
42  packaging.cleanPackages();
43  $('create_shipping_label').checked = false;
44  toggleCreateLabelCheckbox();
45  }
46  });
47  packaging.setItemQtyCallback(function(itemId){
48  var item = $$('[name="shipment[items]['+itemId+']"]')[0];
49  if (item && !isNaN(item.value)) {
50  return item.value;
51  }
52  });
53  jQuery('#packaging_window').modal({
54  type: 'slide',
55  title: '<?= /* @escapeNotVerified */ __('Create Packages') ?>',
56  buttons: [{
57  text: '<?= /* @escapeNotVerified */ __('Cancel') ?>',
58  'class': 'action-secondary',
59  click: function () {
60  packaging.cancelPackaging();
61  this.closeModal();
62  }
63  }, {
64  text: '<?= /* @escapeNotVerified */ __('Save') ?>',
65  'attr': {'disabled':'disabled', 'data-action':'save-packages'},
66  'class': 'action-primary _disabled',
67  click: function () {
68  packaging.confirmPackaging();
69  }
70  }, {
71  text: '<?= /* @escapeNotVerified */ __('Add Package') ?>',
72  'attr': {'data-action':'add-packages'},
73  'class': 'action-secondary',
74  click: function () {
75  packaging.newPackage();
76  }
77  }]
78  });
79  jQuery(document).trigger('packaging:inited');
80  jQuery(document).data('packagingInited', true);
81  });
82 </script>
83 <?php include ($block->getTemplateFile('Magento_Shipping::order/packaging/popup_content.phtml')) ?>
$sizeSource
Definition: popup.phtml:13
$block
Definition: block.php:8
$girthEnabled
Definition: popup.phtml:14
$shippingMethod
Definition: popup.phtml:12
jQuery('.store-switcher .dropdown-menu li a').each(function()
Definition: switcher.phtml:203