Skip to content

Commit 3b6c497

Browse files
author
Idolov, Stanislav(sidolov)
committed
Merge pull request #197 from magento-folks/bugs
[Folks] Bugfix
2 parents 764d75a + a2b0614 commit 3b6c497

File tree

53 files changed

+1223
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1223
-403
lines changed

app/code/Magento/Checkout/Controller/Cart/Delete.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ class Delete extends \Magento\Checkout\Controller\Cart
1515
*/
1616
public function execute()
1717
{
18+
if (!$this->_formKeyValidator->validate($this->getRequest())) {
19+
return $this->resultRedirectFactory->create()->setPath('*/*/');
20+
}
21+
1822
$id = (int)$this->getRequest()->getParam('id');
1923
if ($id) {
2024
try {

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ public function getConfig()
265265
$output['isCustomerLoginRequired'] = $this->isCustomerLoginRequired();
266266
$output['registerUrl'] = $this->getRegisterUrl();
267267
$output['checkoutUrl'] = $this->getCheckoutUrl();
268+
$output['defaultSuccessPageUrl'] = $this->getDefaultSuccessPageUrl();
268269
$output['pageNotFoundUrl'] = $this->pageNotFoundUrl();
269270
$output['forgotPasswordUrl'] = $this->getForgotPasswordUrl();
270271
$output['staticBaseUrl'] = $this->getStaticBaseUrl();
@@ -451,6 +452,17 @@ public function pageNotFoundUrl()
451452
return $this->urlBuilder->getUrl('checkout/noroute');
452453
}
453454

455+
/**
456+
* Retrieve default success page URL
457+
*
458+
* @return string
459+
* @codeCoverageIgnore
460+
*/
461+
public function getDefaultSuccessPageUrl()
462+
{
463+
return $this->urlBuilder->getUrl('checkout/onepage/success/');
464+
}
465+
454466
/**
455467
* Retrieve selected shipping method
456468
*

app/code/Magento/Checkout/etc/adminhtml/system.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
<label>Allow Guest Checkout</label>
2222
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
2323
</field>
24-
<field id="customer_must_be_logged" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
25-
<label>Require Customer To Be Logged In To Checkout</label>
26-
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
27-
<depends>
28-
<field id="guest_checkout">0</field>
29-
</depends>
30-
</field>
3124
</group>
3225
<group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
3326
<label>Shopping Cart</label>

app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication</item>
4242
<item name="displayArea" xsi:type="string">authentication</item>
4343
<item name="children" xsi:type="array">
44-
<!--Additional authentication fields-->
44+
<!--Additional authentication fields-->
4545
<item name="errors" xsi:type="array">
4646
<item name="sortOrder" xsi:type="string">0</item>
4747
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication-messages</item>
@@ -167,7 +167,7 @@
167167
<item name="children" xsi:type="array">
168168
<!-- address-list-additional-addresses -->
169169
</item>
170-
</item>
170+
</item>
171171
<item name="before-shipping-method-form" xsi:type="array">
172172
<item name="component" xsi:type="string">uiComponent</item>
173173
<item name="displayArea" xsi:type="string">before-shipping-method-form</item>
@@ -184,7 +184,7 @@
184184
</item>
185185
<item name="displayArea" xsi:type="string">additional-fieldsets</item>
186186
<item name="children" xsi:type="array">
187-
<!-- The following items override configuration of corresponding address attributes -->
187+
<!-- The following items override configuration of corresponding address attributes -->
188188
<item name="region" xsi:type="array">
189189
<!-- Make region attribute invisible on frontend. Corresponding input element is created by region_id field -->
190190
<item name="visible" xsi:type="boolean">false</item>
@@ -310,6 +310,17 @@
310310
<item name="1" xsi:type="string">checkout.steps.billing-step.payment.additional-payment-validators</item>
311311
</item>
312312
</item>
313+
<item name="children" xsi:type="array">
314+
<item name="before-place-order" xsi:type="array">
315+
<item name="component" xsi:type="string">uiComponent</item>
316+
<item name="displayArea" xsi:type="string">before-place-order</item>
317+
<item name="dataScope" xsi:type="string">before-place-order</item>
318+
<item name="provider" xsi:type="string">checkoutProvider</item>
319+
<item name="config" xsi:type="array">
320+
<item name="template" xsi:type="string">Magento_Checkout/payment/before-place-order</item>
321+
</item>
322+
</item>
323+
</item>
313324
</item>
314325
<!-- merge your payment methods here -->
315326
<item name="afterMethods" xsi:type="array">
@@ -433,4 +444,4 @@
433444
</referenceContainer>
434445
<referenceContainer name="page.messages" remove="true"/>
435446
</body>
436-
</page>
447+
</page>

app/code/Magento/Checkout/view/frontend/templates/cart/minicart.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
data-bind="scope: 'minicart_content'">
1515
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
1616
<span class="counter qty empty"
17-
data-bind="css: { empty: cart().summary_count == 0 }, blockLoader: isLoading">
18-
<span class="counter-number"><!-- ko text: cart().summary_count --><!-- /ko --></span>
17+
data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
18+
<span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
1919
<span class="counter-label">
20-
<!-- ko if: cart().summary_count -->
21-
<!-- ko text: cart().summary_count --><!-- /ko -->
20+
<!-- ko if: getCartParam('summary_count') -->
21+
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
2222
<!-- ko i18n: 'items' --><!-- /ko -->
2323
<!-- /ko -->
2424
</span>

app/code/Magento/Checkout/view/frontend/web/js/action/create-billing-address.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ define(
77
[
88
'Magento_Checkout/js/model/address-converter'
99
],
10-
function(addressConverter) {
11-
"use strict";
12-
return function(addressData) {
10+
function (addressConverter) {
11+
'use strict';
12+
13+
return function (addressData) {
1314
return addressConverter.formAddressDataToQuoteAddress(addressData);
1415
};
1516
}

app/code/Magento/Checkout/view/frontend/web/js/action/get-totals.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,27 @@ define(
1414
'Magento_Checkout/js/model/totals'
1515
],
1616
function ($, quote, resourceUrlManager, errorProcessor, storage, totals) {
17-
"use strict";
17+
'use strict';
18+
1819
return function (callbacks, deferred) {
1920
deferred = deferred || $.Deferred();
2021
totals.isLoading(true);
22+
2123
return storage.get(
2224
resourceUrlManager.getUrlForCartTotals(quote),
2325
false
2426
).done(
2527
function (response) {
26-
totals.isLoading(false);
2728
var proceed = true;
28-
$.each(callbacks, function(index, callback) {
29-
proceed = proceed && callback();
30-
});
29+
30+
totals.isLoading(false);
31+
32+
if (callbacks.length > 0) {
33+
$.each(callbacks, function (index, callback) {
34+
proceed = proceed && callback();
35+
});
36+
}
37+
3138
if (proceed) {
3239
quote.setTotals(response);
3340
deferred.resolve();
@@ -47,4 +54,4 @@ define(
4754

4855
};
4956
}
50-
);
57+
);

app/code/Magento/Checkout/view/frontend/web/js/action/place-order.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,17 @@ define(
77
'Magento_Checkout/js/model/quote',
88
'Magento_Checkout/js/model/url-builder',
99
'mage/storage',
10-
'mage/url',
1110
'Magento_Checkout/js/model/error-processor',
1211
'Magento_Customer/js/model/customer',
1312
'Magento_Checkout/js/model/full-screen-loader'
1413
],
15-
function (quote, urlBuilder, storage, url, errorProcessor, customer, fullScreenLoader) {
14+
function (quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) {
1615
'use strict';
1716

18-
return function (paymentData, redirectOnSuccess, messageContainer) {
17+
return function (paymentData, messageContainer) {
1918
var serviceUrl,
2019
payload;
2120

22-
redirectOnSuccess = redirectOnSuccess !== false;
23-
2421
/** Checkout for guest and registered customer. */
2522
if (!customer.isLoggedIn()) {
2623
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
@@ -45,12 +42,6 @@ define(
4542

4643
return storage.post(
4744
serviceUrl, JSON.stringify(payload)
48-
).done(
49-
function () {
50-
if (redirectOnSuccess) {
51-
window.location.replace(url.build('checkout/onepage/success/'));
52-
}
53-
}
5445
).fail(
5546
function (response) {
5647
errorProcessor.process(response, messageContainer);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Copyright © 2015 Magento. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
define(
6+
[
7+
'mage/url'
8+
],
9+
function (url) {
10+
'use strict';
11+
12+
return {
13+
redirectUrl: window.checkoutConfig.defaultSuccessPageUrl,
14+
15+
/**
16+
* Provide redirect to page
17+
*/
18+
execute: function () {
19+
window.location.replace(url.build(this.redirectUrl));
20+
}
21+
};
22+
}
23+
);

app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define(
1616

1717
if (quote.shippingAddress() && billingAddress.getCacheKey() == quote.shippingAddress().getCacheKey()) {
1818
address = $.extend({}, billingAddress);
19-
address.saveInAddressBook = false;
19+
address.saveInAddressBook = null;
2020
} else {
2121
address = billingAddress;
2222
}

0 commit comments

Comments
 (0)