Skip to content

Commit

Permalink
Merge pull request #197 from magento-folks/bugs
Browse files Browse the repository at this point in the history
[Folks] Bugfix
  • Loading branch information
Idolov, Stanislav(sidolov) committed Nov 20, 2015
2 parents 764d75a + a2b0614 commit 3b6c497
Show file tree
Hide file tree
Showing 53 changed files with 1,223 additions and 403 deletions.
4 changes: 4 additions & 0 deletions app/code/Magento/Checkout/Controller/Cart/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class Delete extends \Magento\Checkout\Controller\Cart
*/
public function execute()
{
if (!$this->_formKeyValidator->validate($this->getRequest())) {
return $this->resultRedirectFactory->create()->setPath('*/*/');
}

$id = (int)$this->getRequest()->getParam('id');
if ($id) {
try {
Expand Down
12 changes: 12 additions & 0 deletions app/code/Magento/Checkout/Model/DefaultConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ public function getConfig()
$output['isCustomerLoginRequired'] = $this->isCustomerLoginRequired();
$output['registerUrl'] = $this->getRegisterUrl();
$output['checkoutUrl'] = $this->getCheckoutUrl();
$output['defaultSuccessPageUrl'] = $this->getDefaultSuccessPageUrl();
$output['pageNotFoundUrl'] = $this->pageNotFoundUrl();
$output['forgotPasswordUrl'] = $this->getForgotPasswordUrl();
$output['staticBaseUrl'] = $this->getStaticBaseUrl();
Expand Down Expand Up @@ -451,6 +452,17 @@ public function pageNotFoundUrl()
return $this->urlBuilder->getUrl('checkout/noroute');
}

/**
* Retrieve default success page URL
*
* @return string
* @codeCoverageIgnore
*/
public function getDefaultSuccessPageUrl()
{
return $this->urlBuilder->getUrl('checkout/onepage/success/');
}

/**
* Retrieve selected shipping method
*
Expand Down
7 changes: 0 additions & 7 deletions app/code/Magento/Checkout/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
<label>Allow Guest Checkout</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
</field>
<field id="customer_must_be_logged" translate="label" type="select" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Require Customer To Be Logged In To Checkout</label>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
<depends>
<field id="guest_checkout">0</field>
</depends>
</field>
</group>
<group id="cart" translate="label" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Shopping Cart</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication</item>
<item name="displayArea" xsi:type="string">authentication</item>
<item name="children" xsi:type="array">
<!--Additional authentication fields-->
<!--Additional authentication fields-->
<item name="errors" xsi:type="array">
<item name="sortOrder" xsi:type="string">0</item>
<item name="component" xsi:type="string">Magento_Checkout/js/view/authentication-messages</item>
Expand Down Expand Up @@ -167,7 +167,7 @@
<item name="children" xsi:type="array">
<!-- address-list-additional-addresses -->
</item>
</item>
</item>
<item name="before-shipping-method-form" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-shipping-method-form</item>
Expand All @@ -184,7 +184,7 @@
</item>
<item name="displayArea" xsi:type="string">additional-fieldsets</item>
<item name="children" xsi:type="array">
<!-- The following items override configuration of corresponding address attributes -->
<!-- The following items override configuration of corresponding address attributes -->
<item name="region" xsi:type="array">
<!-- Make region attribute invisible on frontend. Corresponding input element is created by region_id field -->
<item name="visible" xsi:type="boolean">false</item>
Expand Down Expand Up @@ -310,6 +310,17 @@
<item name="1" xsi:type="string">checkout.steps.billing-step.payment.additional-payment-validators</item>
</item>
</item>
<item name="children" xsi:type="array">
<item name="before-place-order" xsi:type="array">
<item name="component" xsi:type="string">uiComponent</item>
<item name="displayArea" xsi:type="string">before-place-order</item>
<item name="dataScope" xsi:type="string">before-place-order</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">Magento_Checkout/payment/before-place-order</item>
</item>
</item>
</item>
</item>
<!-- merge your payment methods here -->
<item name="afterMethods" xsi:type="array">
Expand Down Expand Up @@ -433,4 +444,4 @@
</referenceContainer>
<referenceContainer name="page.messages" remove="true"/>
</body>
</page>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
data-bind="scope: 'minicart_content'">
<span class="text"><?php /* @escapeNotVerified */ echo __('My Cart'); ?></span>
<span class="counter qty empty"
data-bind="css: { empty: cart().summary_count == 0 }, blockLoader: isLoading">
<span class="counter-number"><!-- ko text: cart().summary_count --><!-- /ko --></span>
data-bind="css: { empty: !!getCartParam('summary_count') == false }, blockLoader: isLoading">
<span class="counter-number"><!-- ko text: getCartParam('summary_count') --><!-- /ko --></span>
<span class="counter-label">
<!-- ko if: cart().summary_count -->
<!-- ko text: cart().summary_count --><!-- /ko -->
<!-- ko if: getCartParam('summary_count') -->
<!-- ko text: getCartParam('summary_count') --><!-- /ko -->
<!-- ko i18n: 'items' --><!-- /ko -->
<!-- /ko -->
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ define(
[
'Magento_Checkout/js/model/address-converter'
],
function(addressConverter) {
"use strict";
return function(addressData) {
function (addressConverter) {
'use strict';

return function (addressData) {
return addressConverter.formAddressDataToQuoteAddress(addressData);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,27 @@ define(
'Magento_Checkout/js/model/totals'
],
function ($, quote, resourceUrlManager, errorProcessor, storage, totals) {
"use strict";
'use strict';

return function (callbacks, deferred) {
deferred = deferred || $.Deferred();
totals.isLoading(true);

return storage.get(
resourceUrlManager.getUrlForCartTotals(quote),
false
).done(
function (response) {
totals.isLoading(false);
var proceed = true;
$.each(callbacks, function(index, callback) {
proceed = proceed && callback();
});

totals.isLoading(false);

if (callbacks.length > 0) {
$.each(callbacks, function (index, callback) {
proceed = proceed && callback();
});
}

if (proceed) {
quote.setTotals(response);
deferred.resolve();
Expand All @@ -47,4 +54,4 @@ define(

};
}
);
);
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ define(
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/url-builder',
'mage/storage',
'mage/url',
'Magento_Checkout/js/model/error-processor',
'Magento_Customer/js/model/customer',
'Magento_Checkout/js/model/full-screen-loader'
],
function (quote, urlBuilder, storage, url, errorProcessor, customer, fullScreenLoader) {
function (quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) {
'use strict';

return function (paymentData, redirectOnSuccess, messageContainer) {
return function (paymentData, messageContainer) {
var serviceUrl,
payload;

redirectOnSuccess = redirectOnSuccess !== false;

/** Checkout for guest and registered customer. */
if (!customer.isLoggedIn()) {
serviceUrl = urlBuilder.createUrl('/guest-carts/:quoteId/payment-information', {
Expand All @@ -45,12 +42,6 @@ define(

return storage.post(
serviceUrl, JSON.stringify(payload)
).done(
function () {
if (redirectOnSuccess) {
window.location.replace(url.build('checkout/onepage/success/'));
}
}
).fail(
function (response) {
errorProcessor.process(response, messageContainer);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define(
[
'mage/url'
],
function (url) {
'use strict';

return {
redirectUrl: window.checkoutConfig.defaultSuccessPageUrl,

/**
* Provide redirect to page
*/
execute: function () {
window.location.replace(url.build(this.redirectUrl));
}
};
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ define(

if (quote.shippingAddress() && billingAddress.getCacheKey() == quote.shippingAddress().getCacheKey()) {
address = $.extend({}, billingAddress);
address.saveInAddressBook = false;
address.saveInAddressBook = null;
} else {
address = billingAddress;
}
Expand Down
Loading

0 comments on commit 3b6c497

Please sign in to comment.