Skip to content

Commit 32262b8

Browse files
Merge branch 'MAGETWO-70646' of github.com:magento-folks/magento2ce into 2.2-bugs
2 parents e6586f8 + 3234a41 commit 32262b8

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

app/code/Magento/Checkout/etc/frontend/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
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>

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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')) ?>

app/code/Magento/Shipping/view/adminhtml/templates/view/form.phtml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,25 +70,30 @@
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>

0 commit comments

Comments
 (0)