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 33
33
<arguments >
34
34
<argument name =" clientSideSections" xsi : type =" array" >
35
35
<item name =" checkout-data" xsi : type =" string" >checkout-data</item >
36
+ <item name =" cart-data" xsi : type =" string" >cart-data</item >
36
37
</argument >
37
38
</arguments >
38
39
</type >
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
21
21
"Magento_Ui/js/modal/modal"
22
22
], function(jQuery){
23
23
24
- packaging = new Packaging(<?= /* @escapeNotVerified */ $ block ->getConfigDataJson () ?> );
24
+ window. packaging = new Packaging(<?= /* @escapeNotVerified */ $ block ->getConfigDataJson () ?> );
25
25
packaging.changeContainerType($$('select[name=package_container]')[0]);
26
26
packaging.checkSizeAndGirthParameter(
27
27
$$('select[name=package_container]')[0],
@@ -76,6 +76,8 @@ $girthEnabled = $block->isDisplayGirthValue() && $block->isGirthAllowed() ? 1 :
76
76
}
77
77
}]
78
78
});
79
+ jQuery(document).trigger('packaging:inited');
80
+ jQuery(document).data('packagingInited', true);
79
81
});
80
82
</script>
81
83
<?php include ($ block ->getTemplateFile ('Magento_Shipping::order/packaging/popup_content.phtml ' )) ?>
Original file line number Diff line number Diff line change 70
70
<?= $ block ->getChildHtml ('shipment_tracking ' ) ?>
71
71
72
72
<?= $ 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
+ };
77
89
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>
92
97
</div>
93
98
</div>
94
99
</div>
You can’t perform that action at this time.
0 commit comments