Skip to content

Commit 384da33

Browse files
committed
MAGETWO-54682: [Customer] Fast load of product options
- Merge remote-tracking branch 'mainline/develop' into MAGETWO-54682
2 parents 4d9e5b3 + 569bbc3 commit 384da33

File tree

18 files changed

+132
-87
lines changed

18 files changed

+132
-87
lines changed

app/code/Magento/Checkout/i18n/en_US.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ Login,Login
121121
Close,Close
122122
item,item
123123
items,items
124-
"Go to Checkout","Go to Checkout"
125124
"Recently added item(s)","Recently added item(s)"
126125
"View and edit cart","View and edit cart"
127126
"See Details","See Details"

app/code/Magento/Checkout/view/frontend/web/js/view/cart/totals.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22
* Copyright © 2016 Magento. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5-
define(
6-
[
7-
'uiComponent',
8-
'Magento_Checkout/js/model/totals',
9-
'Magento_Checkout/js/model/shipping-service'
10-
],
11-
function (Component, totalsService, shippingService) {
12-
'use strict';
5+
define([
6+
'jquery',
7+
'uiComponent',
8+
'Magento_Checkout/js/model/totals',
9+
'Magento_Checkout/js/model/shipping-service'
10+
], function ($, Component, totalsService, shippingService) {
11+
'use strict';
1312

14-
return Component.extend({
13+
return Component.extend({
14+
isLoading: totalsService.isLoading,
1515

16-
isLoading: totalsService.isLoading,
17-
18-
/**
19-
* @override
20-
*/
21-
initialize: function () {
22-
this._super();
23-
totalsService.totals.subscribe(function () {
24-
window.dispatchEvent(new Event('resize'));
25-
});
26-
shippingService.getShippingRates().subscribe(function () {
27-
window.dispatchEvent(new Event('resize'));
28-
});
29-
}
30-
});
31-
}
32-
);
16+
/**
17+
* @override
18+
*/
19+
initialize: function () {
20+
this._super();
21+
totalsService.totals.subscribe(function () {
22+
$(window).trigger('resize');
23+
});
24+
shippingService.getShippingRates().subscribe(function () {
25+
$(window).trigger('resize');
26+
});
27+
}
28+
});
29+
});

app/code/Magento/Checkout/view/frontend/web/template/minicart/content.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,8 @@
3636
<!-- /ko -->
3737
</div>
3838

39-
<!-- ko if: getCartParam('possible_onepage_checkout') -->
40-
<!-- ko foreach: getRegion('subtotalContainer') -->
41-
<!-- ko template: getTemplate() --><!-- /ko -->
42-
<!-- /ko -->
39+
<!-- ko foreach: getRegion('subtotalContainer') -->
40+
<!-- ko template: getTemplate() --><!-- /ko -->
4341
<!-- /ko -->
4442

4543
<!-- ko foreach: getRegion('extraInfo') -->
@@ -56,11 +54,11 @@
5654
data-action="close"
5755
data-bind="
5856
attr: {
59-
title: $t('Go to Checkout')
57+
title: $t('Proceed to Checkout')
6058
},
6159
click: closeMinicart()
6260
">
63-
<!-- ko i18n: 'Go to Checkout' --><!-- /ko -->
61+
<!-- ko i18n: 'Proceed to Checkout' --><!-- /ko -->
6462
</button>
6563
<div data-bind="html: getCartParam('extra_actions')"></div>
6664
</div>

app/code/Magento/Customer/view/frontend/templates/address/edit.phtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@
7575
value="<?php echo $block->escapeHtml($block->getStreetLine(1)) ?>"
7676
title="<?php /* @escapeNotVerified */ echo __('Street Address') ?>"
7777
id="street_1"
78-
class="input-text <?php /* @escapeNotVerified */
79-
echo $_streetValidationClass ?>"/>
78+
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>"/>
8079
<div class="nested">
8180
<?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?>
8281
<?php for ($_i = 1, $_n = $this->helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i < $_n; $_i++): ?>
8382
<div class="field additional">
84-
<label class="label" for="street_<?php /* @escapeNotVerified */ echo $_i+1 ?>">
85-
<span><?php /* @escapeNotVerified */ echo __('Street Address %1', $_i+1) ?></span>
83+
<label class="label" for="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>">
84+
<span><?php /* @escapeNotVerified */ echo __('Street Address %1', $_i + 1) ?></span>
8685
</label>
8786
<div class="control">
8887
<input type="text" name="street[]"
8988
value="<?php echo $block->escapeHtml($block->getStreetLine($_i + 1)) ?>"
9089
title="<?php /* @escapeNotVerified */ echo __('Street Address %1', $_i + 1) ?>"
91-
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>" echo $_streetValidationClass ?>">
90+
id="street_<?php /* @escapeNotVerified */ echo $_i + 1 ?>"
91+
class="input-text <?php /* @escapeNotVerified */ echo $_streetValidationClass ?>">
9292
</div>
9393
</div>
9494
<?php endfor; ?>

app/code/Magento/Dhl/view/frontend/web/js/model/shipping-rates-validation-rules.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ define(
1616
},
1717
'country_id': {
1818
'required': true
19+
},
20+
'city': {
21+
'required': true
1922
}
2023
};
2124
}

app/code/Magento/Fedex/Model/Carrier.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
namespace Magento\Fedex\Model;
1010

1111
use Magento\Framework\Module\Dir;
12+
use Magento\Framework\Xml\Security;
1213
use Magento\Quote\Model\Quote\Address\RateRequest;
1314
use Magento\Shipping\Model\Carrier\AbstractCarrierOnline;
1415
use Magento\Shipping\Model\Rate\Result;
15-
use Magento\Framework\Xml\Security;
1616

1717
/**
1818
* Fedex shipping implementation
@@ -123,7 +123,7 @@ class Carrier extends AbstractCarrierOnline implements \Magento\Shipping\Model\C
123123
* @inheritdoc
124124
*/
125125
protected $_debugReplacePrivateDataKeys = [
126-
'Key', 'Password', 'MeterNumber'
126+
'Key', 'Password', 'MeterNumber',
127127
];
128128

129129
/**
@@ -338,6 +338,10 @@ public function setRequest(RateRequest $request)
338338
} else {
339339
}
340340

341+
if ($request->getDestCity()) {
342+
$r->setDestCity($request->getDestCity());
343+
}
344+
341345
$weight = $this->getTotalNumOfBoxes($request->getPackageWeight());
342346
$r->setWeight($weight);
343347
if ($request->getFreeMethodWeight() != $request->getPackageWeight()) {
@@ -432,6 +436,10 @@ protected function _formRateRequest($purpose)
432436
],
433437
];
434438

439+
if ($r->getDestCity()) {
440+
$ratesRequest['RequestedShipment']['Recipient']['Address']['City'] = $r->getDestCity();
441+
}
442+
435443
if ($purpose == self::RATE_REQUEST_GENERAL) {
436444
$ratesRequest['RequestedShipment']['RequestedPackageLineItems'][0]['InsuredValue'] = [
437445
'Amount' => $r->getValue(),
@@ -637,8 +645,8 @@ protected function _setFreeMethodRequest($freeMethod)
637645
protected function _getXmlQuotes()
638646
{
639647
$r = $this->_rawRequest;
640-
$xml = $this->_xmlElFactory->create(
641-
648+
$xml = $this->_xmlElFactory->create(
649+
642650
['data' => '<?xml version = "1.0" encoding = "UTF-8"?><FDXRateAvailableServicesRequest/>']
643651
);
644652

@@ -870,14 +878,14 @@ public function getCode($type, $code = '')
870878
'from_us' => [
871879
'method' => ['INTERNATIONAL_FIRST', 'INTERNATIONAL_ECONOMY', 'INTERNATIONAL_PRIORITY'],
872880
],
873-
]
881+
],
874882
],
875883
[
876884
'containers' => ['FEDEX_10KG_BOX', 'FEDEX_25KG_BOX'],
877885
'filters' => [
878886
'within_us' => [],
879887
'from_us' => ['method' => ['INTERNATIONAL_PRIORITY']],
880-
]
888+
],
881889
],
882890
[
883891
'containers' => ['YOUR_PACKAGING'],
@@ -915,7 +923,7 @@ public function getCode($type, $code = '')
915923
'INTERNATIONAL_PRIORITY_FREIGHT',
916924
],
917925
],
918-
]
926+
],
919927
],
920928
],
921929
'delivery_confirmation_types' => [
@@ -1232,7 +1240,7 @@ protected function _getAuthDetails()
12321240
'TransactionDetail' => [
12331241
'CustomerTransactionId' => '*** Express Domestic Shipping Request v9 using PHP ***',
12341242
],
1235-
'Version' => ['ServiceId' => 'ship', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0']
1243+
'Version' => ['ServiceId' => 'ship', 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0'],
12361244
];
12371245
}
12381246

@@ -1407,7 +1415,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request)
14071415
'Length' => $length,
14081416
'Width' => $width,
14091417
'Height' => $height,
1410-
'Units' => $packageParams->getDimensionUnits() == \Zend_Measure_Length::INCH ? 'IN' : 'CM'
1418+
'Units' => $packageParams->getDimensionUnits() == \Zend_Measure_Length::INCH ? 'IN' : 'CM',
14111419
];
14121420
}
14131421

@@ -1463,9 +1471,10 @@ protected function _doShipmentRequest(\Magento\Framework\DataObject $request)
14631471
* @param array|object $trackingIds
14641472
* @return string
14651473
*/
1466-
private function getTrackingNumber($trackingIds) {
1474+
private function getTrackingNumber($trackingIds)
1475+
{
14671476
return is_array($trackingIds) ? array_map(
1468-
function($val) {
1477+
function ($val) {
14691478
return $val->TrackingNumber;
14701479
},
14711480
$trackingIds

app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\Fedex\Test\Unit\Model;
77

88
use Magento\Fedex\Model\Carrier;
9-
use Magento\Framework\DataObject;
109
use Magento\Framework\Xml\Security;
1110
use Magento\Quote\Model\Quote\Address\RateRequest;
1211

@@ -118,10 +117,8 @@ protected function setUp()
118117
'',
119118
false
120119
),
121-
'trackErrorFactory' =>
122-
$this->getMock(\Magento\Shipping\Model\Tracking\Result\ErrorFactory::class, [], [], '', false),
123-
'trackStatusFactory' =>
124-
$this->getMock(\Magento\Shipping\Model\Tracking\Result\StatusFactory::class, [], [], '', false),
120+
'trackErrorFactory' => $this->getMock(\Magento\Shipping\Model\Tracking\Result\ErrorFactory::class, [], [], '', false),
121+
'trackStatusFactory' => $this->getMock(\Magento\Shipping\Model\Tracking\Result\StatusFactory::class, [], [], '', false),
125122
'regionFactory' => $this->getMock(\Magento\Directory\Model\RegionFactory::class, [], [], '', false),
126123
'countryFactory' => $countryFactory,
127124
'currencyFactory' => $this->getMock(\Magento\Directory\Model\CurrencyFactory::class, [], [], '', false),
@@ -135,19 +132,42 @@ protected function setUp()
135132
),
136133
'storeManager' => $storeManager,
137134
'configReader' => $this->getMock(\Magento\Framework\Module\Dir\Reader::class, [], [], '', false),
138-
'productCollectionFactory' =>
139-
$this->getMock(
135+
'productCollectionFactory' => $this->getMock(
140136
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class,
141137
[],
142138
[],
143139
'',
144140
false
145141
),
146-
'data' => []
142+
'data' => [],
147143
]
148144
);
149145
}
150146

147+
public function testSetRequestWithoutCity()
148+
{
149+
$requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
150+
->disableOriginalConstructor()
151+
->setMethods(['getDestCity'])
152+
->getMock();
153+
$requestMock->expects($this->once())
154+
->method('getDestCity')
155+
->willReturn(null);
156+
$this->_model->setRequest($requestMock);
157+
}
158+
159+
public function testSetRequestWithCity()
160+
{
161+
$requestMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address\RateRequest::class)
162+
->disableOriginalConstructor()
163+
->setMethods(['getDestCity'])
164+
->getMock();
165+
$requestMock->expects($this->exactly(2))
166+
->method('getDestCity')
167+
->willReturn('Small Town');
168+
$this->_model->setRequest($requestMock);
169+
}
170+
151171
/**
152172
* Callback function, emulates getValue function
153173
* @param $path
@@ -194,7 +214,16 @@ public function testCollectRatesRateAmountOriginBased($amount, $rateType, $expec
194214
$this->_model->expects($this->any())->method('_getCachedQuotes')->will(
195215
$this->returnValue(serialize($response))
196216
);
197-
$request = $this->getMock(\Magento\Quote\Model\Quote\Address\RateRequest::class, [], [], '', false);
217+
$request = $this->getMock(
218+
\Magento\Quote\Model\Quote\Address\RateRequest::class,
219+
['getDestCity'],
220+
[],
221+
'',
222+
false
223+
);
224+
$request->expects($this->exactly(2))
225+
->method('getDestCity')
226+
->willReturn('Wonderful City');
198227
foreach ($this->_model->collectRates($request)->getAllRates() as $allRates) {
199228
$this->assertEquals($expected, $allRates->getData('cost'));
200229
}
@@ -259,26 +288,26 @@ public function logDataProvider()
259288
'WebAuthenticationDetail' => [
260289
'UserCredential' => [
261290
'Key' => 'testKey',
262-
'Password' => 'testPassword'
263-
]
291+
'Password' => 'testPassword',
292+
],
264293
],
265294
'ClientDetail' => [
266295
'AccountNumber' => 4121213,
267-
'MeterNumber' => 'testMeterNumber'
268-
]
296+
'MeterNumber' => 'testMeterNumber',
297+
],
269298
],
270299
['Key', 'Password', 'MeterNumber'],
271300
[
272301
'WebAuthenticationDetail' => [
273302
'UserCredential' => [
274303
'Key' => '****',
275-
'Password' => '****'
276-
]
304+
'Password' => '****',
305+
],
277306
],
278307
'ClientDetail' => [
279308
'AccountNumber' => 4121213,
280-
'MeterNumber' => '****'
281-
]
309+
'MeterNumber' => '****',
310+
],
282311
],
283312
],
284313
];

app/code/Magento/Fedex/view/frontend/web/js/model/shipping-rates-validation-rules.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ define(
1616
},
1717
'country_id': {
1818
'required': true
19+
},
20+
'city': {
21+
'required': true
1922
}
2023
};
2124
}

app/code/Magento/Sales/Model/ResourceModel/Order/Handler/State.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class State
2323
*/
2424
public function check(Order $order)
2525
{
26-
if (!$order->getId()) {
27-
return $order;
28-
}
2926
if (!$order->isCanceled() && !$order->canUnhold() && !$order->canInvoice() && !$order->canShip()) {
3027
if (0 == $order->getBaseGrandTotal() || $order->canCreditmemo()) {
3128
if ($order->getState() !== Order::STATE_COMPLETE) {

0 commit comments

Comments
 (0)