File tree Expand file tree Collapse file tree 3 files changed +27
-19
lines changed
Shipping/view/adminhtml/templates Expand file tree Collapse file tree 3 files changed +27
-19
lines changed Original file line number Diff line number Diff line change 3333 <arguments >
3434 <argument name =" clientSideSections" xsi : type =" array" >
3535 <item name =" checkout-data" xsi : type =" string" >checkout-data</item >
36+ <item name =" cart-data" xsi : type =" string" >cart-data</item >
3637 </argument >
3738 </arguments >
3839 </type >
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
2121 "Magento_Ui/js/modal/modal"
2222 ], function(jQuery){
2323
24- packaging = new Packaging(<?= /* @escapeNotVerified */ $ block ->getConfigDataJson () ?> );
24+ window. packaging = new Packaging(<?= /* @escapeNotVerified */ $ block ->getConfigDataJson () ?> );
2525 packaging.changeContainerType($$('select[name=package_container]')[0]);
2626 packaging.checkSizeAndGirthParameter(
2727 $$('select[name=package_container]')[0],
@@ -76,6 +76,8 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
7676 }
7777 }]
7878 });
79+ jQuery(document).trigger('packaging:inited');
80+ jQuery(document).data('packagingInited', true);
7981 });
8082</script>
8183<?php include ($ block ->getTemplateFile ('Magento_Shipping::order/packaging/popup_content.phtml ' )) ?>
Original file line number Diff line number Diff line change 7070 <?= $ block ->getChildHtml ('shipment_tracking ' ) ?>
7171
7272 <?= $ block ->getChildHtml ('shipment_packaging ' ) ?>
73- <script>
74- require([
75- 'prototype'
76- ], function () {
73+ <script>
74+ require([
75+ 'jquery',
76+ 'prototype'
77+ ], function (jQuery) {
78+ var setCallbacks = function () {
79+ window.packaging.setConfirmPackagingCallback(function () {
80+ window.packaging.sendCreateLabelRequest();
81+ });
82+ window.packaging.setLabelCreatedCallback(function () {
83+ setLocation("<?php /* @escapeNotVerified */ echo $ block ->getUrl (
84+ 'adminhtml/order_shipment/view ' ,
85+ ['shipment_id ' => $ block ->getShipment ()->getId ()]
86+ ); ?> ");
87+ });
88+ };
7789
78- setTimeout(function () {
79- packaging.setConfirmPackagingCallback(function () {
80- packaging.sendCreateLabelRequest();
81- });
82- packaging.setLabelCreatedCallback(function (response) {
83- setLocation("<?php /* @escapeNotVerified */ echo $ block ->getUrl (
84- 'adminhtml/order_shipment/view ' ,
85- ['shipment_id ' => $ block ->getShipment ()->getId ()]
86- ); ?> ");
87- });
88- }, 500);
89-
90- });
91- </script>
90+ if (jQuery(document).data('packagingInited')) {
91+ setCallbacks();
92+ } else {
93+ jQuery(document).on('packaging:inited', setCallbacks);
94+ }
95+ });
96+ </script>
9297 </div>
9398 </div>
9499 </div>
You can’t perform that action at this time.
0 commit comments