Skip to content

Commit 43d67e9

Browse files
committed
MC-38226: Unexpected behavior on the PayPal express review page during loading
1 parent 55c4ff8 commit 43d67e9

File tree

2 files changed

+42
-46
lines changed

2 files changed

+42
-46
lines changed

app/code/Magento/Paypal/view/frontend/templates/express/review.phtml

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
* See COPYING.txt for license details.
55
*/
66

7+
use Magento\Framework\Escaper;
8+
use Magento\Framework\View\Helper\SecureHtmlRenderer;
9+
use Magento\Paypal\Block\Express\Review;
10+
711
/**
8-
* @var \Magento\Paypal\Block\Express\Review $block
9-
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
12+
* @var Review $block
13+
* @var Escaper $escaper
14+
* @var SecureHtmlRenderer $secureRenderer
1015
*/
1116
?>
1217
<div class="paypal-review view">
@@ -15,11 +20,11 @@
1520
<?php if ($block->getShippingAddress()): ?>
1621
<div class="box box-order-shipping-method">
1722
<strong class="box-title">
18-
<span><?= $block->escapeHtml(__('Shipping Method')) ?></span>
23+
<span><?= $escaper->escapeHtml(__('Shipping Method')) ?></span>
1924
</strong>
2025
<div class="box-content">
2126
<form method="post" id="shipping-method-form"
22-
action="<?= $block->escapeUrl($block->getShippingMethodSubmitUrl()) ?>"
27+
action="<?= $escaper->escapeUrl($block->getShippingMethodSubmitUrl()) ?>"
2328
class="form">
2429
<?php if ($block->canEditShippingMethod()): ?>
2530
<?php if ($groups = $block->getShippingRateGroups()): ?>
@@ -28,11 +33,14 @@
2833
<select name="shipping_method" id="shipping-method" class="select">
2934
<?php if (!$currentRate): ?>
3035
<option value="">
31-
<?= $block->escapeHtml(__('Please select a shipping method...')); ?>
36+
<?= $escaper->escapeHtml(
37+
__('Please select a shipping method...')
38+
); ?>
3239
</option>
3340
<?php endif; ?>
3441
<?php foreach ($groups as $code => $rates): ?>
35-
<optgroup label="<?= $block->escapeHtml($block->getCarrierName($code));
42+
<optgroup label="<?=
43+
$escaper->escapeHtml($block->getCarrierName($code));
3644
?>">
3745
<?php foreach ($rates as $rate): ?>
3846
<option value="<?=
@@ -51,19 +59,10 @@
5159
<?php endforeach; ?>
5260
</select>
5361
</div>
54-
<div class="actions-toolbar">
55-
<div class="primary">
56-
<button id="update-shipping-method-submit" type="submit"
57-
class="action update primary">
58-
<span>
59-
<?= $block->escapeHtml(__('Update Shipping Method')) ?>
60-
</span>
61-
</button>
62-
</div>
63-
</div>
62+
<div class="actions-toolbar"></div>
6463
<?php else: ?>
6564
<p>
66-
<?= $block->escapeHtml(__(
65+
<?= $escaper->escapeHtml(__(
6766
'Sorry, no quotes are available for this order right now.'
6867
)); ?>
6968
</p>
@@ -80,40 +79,40 @@
8079
</div>
8180
<div class="box box-order-shipping-address">
8281
<strong class="box-title">
83-
<span><?= $block->escapeHtml(__('Shipping Address')) ?></span>
82+
<span><?= $escaper->escapeHtml(__('Shipping Address')) ?></span>
8483
</strong>
8584
<div class="box-content">
8685
<address>
87-
<?= $block->escapeHtml(
86+
<?= $escaper->escapeHtml(
8887
$block->renderAddress($block->getShippingAddress()),
8988
['br']
90-
);?>
89+
); ?>
9190
</address>
9291
</div>
9392
<?php if ($block->getCanEditShippingAddress()): ?>
9493
<div class="box-actions">
95-
<a href="<?= $block->escapeUrl($block->getEditUrl()) ?>" class="action edit">
96-
<span><?= $block->escapeHtml(__('Edit')) ?></span>
94+
<a href="<?= $escaper->escapeUrl($block->getEditUrl()) ?>" class="action edit">
95+
<span><?= $escaper->escapeHtml(__('Edit')) ?></span>
9796
</a>
9897
</div>
9998
<?php endif; ?>
10099
</div>
101100
<?php endif; ?>
102101
<div class="box box-order-billing-address">
103-
<strong class="box-title"><span><?= $block->escapeHtml(__('Payment Method')) ?></span></strong>
102+
<strong class="box-title"><span><?= $escaper->escapeHtml(__('Payment Method')) ?></span></strong>
104103
<div class="box-content">
105-
<?= $block->escapeHtml($block->getPaymentMethodTitle()) ?><br>
106-
<?= $block->escapeHtml($block->getEmail()) ?> <br>
104+
<?= $escaper->escapeHtml($block->getPaymentMethodTitle()) ?><br>
105+
<?= $escaper->escapeHtml($block->getEmail()) ?> <br>
107106
<img src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png"
108107
alt="<?= $block->escapeHtml(__('Buy now with PayPal')) ?>"/>
109108
</div>
110-
<?php if ($block->getEditUrl()): ?>
111-
<div class="box-actions">
112-
<a href="<?= $block->escapeUrl($block->getEditUrl()) ?>" class="action edit">
113-
<span><?= $block->escapeHtml(__('Edit Payment Information')) ?></span>
114-
</a>
115-
</div>
116-
<?php endif ?>
109+
<?php if ($block->getEditUrl()): ?>
110+
<div class="box-actions">
111+
<a href="<?= $escaper->escapeUrl($block->getEditUrl()) ?>" class="action edit">
112+
<span><?= $escaper->escapeHtml(__('Edit Payment Information')) ?></span>
113+
</a>
114+
</div>
115+
<?php endif ?>
117116
</div>
118117
</div>
119118
</div>
@@ -124,29 +123,29 @@
124123

125124
<div class="paypal-review-items">
126125
<div class="paypal-review-title">
127-
<strong><?= $block->escapeHtml(__('Items in Your Shopping Cart')) ?></strong>
128-
<a href="<?= $block->escapeUrl($block->getUrl('checkout/cart')) ?>" class="action edit">
129-
<span><?= $block->escapeHtml(__('Edit Shopping Cart')) ?></span>
126+
<strong><?= $escaper->escapeHtml(__('Items in Your Shopping Cart')) ?></strong>
127+
<a href="<?= $escaper->escapeUrl($block->getUrl('checkout/cart')) ?>" class="action edit">
128+
<span><?= $escaper->escapeHtml(__('Edit Shopping Cart')) ?></span>
130129
</a>
131130
</div>
132131

133132
<?= $block->getChildHtml('details') ?>
134133

135-
<form method="post" id="order-review-form" action="<?= $block->escapeUrl($block->getPlaceOrderUrl()) ?>"
134+
<form method="post" id="order-review-form" action="<?= $escaper->escapeUrl($block->getPlaceOrderUrl()) ?>"
136135
class="form order-review-form">
137136
<?= $block->getChildHtml('agreements') ?>
138137
<div class="actions-toolbar" id="review-buttons-container">
139138
<div class="primary">
140139
<button type="button" id="review-button" class="action checkout primary"
141-
value="<?= $block->escapeHtml(__('Place Order')) ?>">
142-
<span><?= $block->escapeHtml(__('Place Order')) ?></span>
140+
value="<?= $escaper->escapeHtml(__('Place Order')) ?>">
141+
<span><?= $escaper->escapeHtml(__('Place Order')) ?></span>
143142
</button>
144143
</div>
145144
<span class="please-wait load indicator" id="review-please-wait"
146-
data-text="<?= $block->escapeHtml(__('Submitting order information...')) ?>">
147-
<span><?= $block->escapeHtml(__('Submitting order information...')) ?></span>
145+
data-text="<?= $escaper->escapeHtml(__('Submitting order information...')) ?>">
146+
<span><?= $escaper->escapeHtml(__('Submitting order information...')) ?></span>
148147
</span>
149-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display: none;", 'span#review-please-wait')?>
148+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display: none;", 'span#review-please-wait') ?>
150149
</div>
151150
</form>
152151
</div>
@@ -158,7 +157,7 @@
158157
"orderReview": {
159158
"shippingSubmitFormSelector": "#shipping-method-form",
160159
"shippingSelector": "#shipping-method",
161-
"shippingMethodUpdateUrl": "<?= $block->escapeUrl($block->getUpdateShippingMethodsUrl()) ?>",
160+
"shippingMethodUpdateUrl": "<?= $escaper->escapeJs($block->getUpdateShippingMethodsUrl()) ?>",
162161
"isAjax": <?= /* @noEscape */ $block->getUseAjax() ? 'true' : 'false' ?>,
163162
"canEditShippingMethod": <?= /* @noEscape */ $block->canEditShippingMethod() ? 'true' : 'false' ?>
164163
}

app/code/Magento/Paypal/view/frontend/web/js/order-review.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ define([
2525
shippingMethodContainer: '#shipping-method-container',
2626
agreementSelector: 'div.checkout-agreements input',
2727
isAjax: false,
28-
updateShippingMethodSubmitSelector: '#update-shipping-method-submit',
2928
shippingMethodUpdateUrl: null,
3029
updateOrderSubmitUrl: null,
3130
canEditShippingMethod: false
@@ -55,14 +54,12 @@ define([
5554
this.options.updateOrderSubmitUrl,
5655
this.options.updateContainerSelector
5756
)
58-
).find(this.options.updateOrderSelector).on('click', $.proxy(this._updateOrderHandler, this)).end()
59-
.find(this.options.updateShippingMethodSubmitSelector).hide().end();
57+
).find(this.options.updateOrderSelector).on('click', $.proxy(this._updateOrderHandler, this)).end();
6058
this._shippingTobilling();
6159

6260
if ($(this.options.shippingSubmitFormSelector).length && this.options.canEditShippingMethod) {
6361
this.isShippingSubmitForm = true;
6462
$(this.options.shippingSubmitFormSelector)
65-
.find(this.options.updateShippingMethodSubmitSelector).hide().end()
6663
.on('change',
6764
this.options.shippingSelector,
6865
$.proxy(

0 commit comments

Comments
 (0)