Skip to content

Commit 3453461

Browse files
author
olysenko
committed
Merge remote-tracking branch 'origin/2.2-develop' into bugfixes
2 parents 8c63e42 + 32892a4 commit 3453461

File tree

63 files changed

+192
-119
lines changed

Some content is hidden

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

63 files changed

+192
-119
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
define([
88
'jquery',
99
'underscore',
10+
'mage/utils/wrapper',
1011
'Magento_Checkout/js/view/payment/default',
1112
'Magento_Braintree/js/view/payment/adapter',
1213
'Magento_Checkout/js/model/quote',
@@ -18,6 +19,7 @@ define([
1819
], function (
1920
$,
2021
_,
22+
wrapper,
2123
Component,
2224
Braintree,
2325
quote,
@@ -218,8 +220,9 @@ define([
218220

219221
/**
220222
* Re-init PayPal Auth Flow
223+
* @param {Function} callback - Optional callback
221224
*/
222-
reInitPayPal: function () {
225+
reInitPayPal: function (callback) {
223226
if (Braintree.checkout) {
224227
Braintree.checkout.teardown(function () {
225228
Braintree.checkout = null;
@@ -228,6 +231,18 @@ define([
228231

229232
this.disableButton();
230233
this.clientConfig.paypal.amount = this.grandTotalAmount;
234+
this.clientConfig.paypal.shippingAddressOverride = this.getShippingAddress();
235+
236+
if (callback) {
237+
this.clientConfig.onReady = wrapper.wrap(
238+
this.clientConfig.onReady,
239+
function (original, checkout) {
240+
this.clientConfig.onReady = original;
241+
original(checkout);
242+
callback();
243+
}.bind(this)
244+
);
245+
}
231246

232247
Braintree.setConfig(this.clientConfig);
233248
Braintree.setup();
@@ -404,15 +419,19 @@ define([
404419
* Triggers when customer click "Continue to PayPal" button
405420
*/
406421
payWithPayPal: function () {
407-
if (additionalValidators.validate()) {
422+
this.reInitPayPal(function () {
423+
if (!additionalValidators.validate()) {
424+
return;
425+
}
426+
408427
try {
409428
Braintree.checkout.paypal.initAuthFlow();
410429
} catch (e) {
411430
this.messageContainer.addErrorMessage({
412431
message: $t('Payment ' + this.getTitle() + ' can\'t be initialized.')
413432
});
414433
}
415-
}
434+
}.bind(this));
416435
},
417436

418437
/**

app/code/Magento/Catalog/Console/Command/ImagesResizeCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ private function getViewImages(array $themes): array
216216
]);
217217
$images = $config->getMediaEntities('Magento_Catalog', ImageHelper::MEDIA_TYPE_CONFIG_NODE);
218218
foreach ($images as $imageId => $imageData) {
219-
$uniqIndex = $this->getUniqImageIndex($imageData);
219+
$uniqIndex = $this->getUniqueImageIndex($imageData);
220220
$imageData['id'] = $imageId;
221221
$viewImages[$uniqIndex] = $imageData;
222222
}
@@ -225,11 +225,11 @@ private function getViewImages(array $themes): array
225225
}
226226

227227
/**
228-
* Get uniq image index
228+
* Get unique image index
229229
* @param array $imageData
230230
* @return string
231231
*/
232-
private function getUniqImageIndex(array $imageData): string
232+
private function getUniqueImageIndex(array $imageData): string
233233
{
234234
ksort($imageData);
235235
unset($imageData['type']);

app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public function getOptionPrice($optionValue, $basePrice)
338338
{
339339
$option = $this->getOption();
340340

341-
return $this->_getChargableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice);
341+
return $this->_getChargeableOptionPrice($option->getPrice(), $option->getPriceType() == 'percent', $basePrice);
342342
}
343343

344344
/**
@@ -392,14 +392,27 @@ public function getProductOptions()
392392
}
393393

394394
/**
395-
* Return final chargable price for option
396-
*
397395
* @param float $price Price of option
398396
* @param boolean $isPercent Price type - percent or fixed
399397
* @param float $basePrice For percent price type
400398
* @return float
399+
* @deprecated 102.0.4 typo in method name
400+
* @see _getChargeableOptionPrice
401401
*/
402402
protected function _getChargableOptionPrice($price, $isPercent, $basePrice)
403+
{
404+
return $this->_getChargeableOptionPrice($price, $isPercent, $basePrice);
405+
}
406+
407+
/**
408+
* Return final chargeable price for option
409+
*
410+
* @param float $price Price of option
411+
* @param boolean $isPercent Price type - percent or fixed
412+
* @param float $basePrice For percent price type
413+
* @return float
414+
*/
415+
protected function _getChargeableOptionPrice($price, $isPercent, $basePrice)
403416
{
404417
if ($isPercent) {
405418
return $basePrice * $price / 100;

app/code/Magento/Catalog/Model/Product/Option/Type/Select.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function getOptionPrice($optionValue, $basePrice)
222222
foreach (explode(',', $optionValue) as $value) {
223223
$_result = $option->getValueById($value);
224224
if ($_result) {
225-
$result += $this->_getChargableOptionPrice(
225+
$result += $this->_getChargeableOptionPrice(
226226
$_result->getPrice(),
227227
$_result->getPriceType() == 'percent',
228228
$basePrice
@@ -237,7 +237,7 @@ public function getOptionPrice($optionValue, $basePrice)
237237
} elseif ($this->_isSingleSelection()) {
238238
$_result = $option->getValueById($optionValue);
239239
if ($_result) {
240-
$result = $this->_getChargableOptionPrice(
240+
$result = $this->_getChargeableOptionPrice(
241241
$_result->getPrice(),
242242
$_result->getPriceType() == 'percent',
243243
$basePrice

app/code/Magento/Catalog/Plugin/Block/Topmenu.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ private function getCategoryAsArray($category, $currentCategory, $isParentActive
162162
'url' => $this->catalogCategory->getCategoryUrl($category),
163163
'has_active' => in_array((string)$category->getId(), explode('/', $currentCategory->getPath()), true),
164164
'is_active' => $category->getId() == $currentCategory->getId(),
165+
'is_category' => true,
165166
'is_parent_active' => $isParentActive
166167
];
167168
}

app/code/Magento/Catalog/Setup/InstallSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
674674
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
675675
null,
676676
['unsigned' => true, 'nullable' => false, 'default' => '0'],
677-
'Attriute Set ID'
677+
'Attribute Set ID'
678678
)
679679
->addColumn(
680680
'parent_id',

app/code/Magento/Catalog/view/frontend/web/js/product/breadcrumbs.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ define([
1616
categoryUrlSuffix: '',
1717
useCategoryPathInUrl: false,
1818
product: '',
19+
categoryItemSelector: '.category-item',
1920
menuContainer: '[data-action="navigation"] > ul'
2021
},
2122

@@ -142,7 +143,10 @@ define([
142143
categoryMenuItem = null;
143144

144145
if (categoryUrl && menu.length) {
145-
categoryMenuItem = menu.find('a[href="' + categoryUrl + '"]');
146+
categoryMenuItem = menu.find(
147+
this.options.categoryItemSelector +
148+
' > a[href="' + categoryUrl + '"]'
149+
);
146150
}
147151

148152
return categoryMenuItem;

app/code/Magento/Customer/Model/Customer/NotificationStorage.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Customer\Model\Customer;
77

8+
use Magento\Framework\App\ObjectManager;
89
use Magento\Framework\Cache\FrontendInterface;
910
use Magento\Framework\Serialize\SerializerInterface;
1011

@@ -18,21 +19,21 @@ class NotificationStorage
1819
private $cache;
1920

2021
/**
21-
* @param FrontendInterface $cache
22-
*/
23-
24-
/**
25-
* @param FrontendInterface $cache
22+
* @var SerializerInterface
2623
*/
2724
private $serializer;
2825

2926
/**
3027
* NotificationStorage constructor.
3128
* @param FrontendInterface $cache
29+
* @param SerializerInterface $serializer
3230
*/
33-
public function __construct(FrontendInterface $cache)
34-
{
31+
public function __construct(
32+
FrontendInterface $cache,
33+
SerializerInterface $serializer = null
34+
) {
3535
$this->cache = $cache;
36+
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
3637
}
3738

3839
/**
@@ -45,7 +46,7 @@ public function __construct(FrontendInterface $cache)
4546
public function add($notificationType, $customerId)
4647
{
4748
$this->cache->save(
48-
$this->getSerializer()->serialize([
49+
$this->serializer->serialize([
4950
'customer_id' => $customerId,
5051
'notification_type' => $notificationType
5152
]),
@@ -88,19 +89,4 @@ private function getCacheKey($notificationType, $customerId)
8889
{
8990
return 'notification_' . $notificationType . '_' . $customerId;
9091
}
91-
92-
/**
93-
* Get serializer
94-
*
95-
* @return SerializerInterface
96-
* @deprecated 100.2.0
97-
*/
98-
private function getSerializer()
99-
{
100-
if ($this->serializer === null) {
101-
$this->serializer = \Magento\Framework\App\ObjectManager::getInstance()
102-
->get(SerializerInterface::class);
103-
}
104-
return $this->serializer;
105-
}
10692
}

app/code/Magento/Paypal/Model/Api/Nvp.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ public function callGetPalDetails()
10271027
}
10281028

10291029
/**
1030-
* Set Customer BillingA greement call
1030+
* Set Customer BillingAgreement call
10311031
*
10321032
* @return void
10331033
* @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetCustomerBillingAgreement
@@ -1427,15 +1427,15 @@ protected function _deformatNVP($nvpstr)
14271427
$nvpstr = strpos($nvpstr, "\r\n\r\n") !== false ? substr($nvpstr, strpos($nvpstr, "\r\n\r\n") + 4) : $nvpstr;
14281428

14291429
while (strlen($nvpstr)) {
1430-
//postion of Key
1430+
//position of Key
14311431
$keypos = strpos($nvpstr, '=');
14321432
//position of value
14331433
$valuepos = strpos($nvpstr, '&') ? strpos($nvpstr, '&') : strlen($nvpstr);
14341434

14351435
/*getting the Key and Value values and storing in a Associative Array*/
14361436
$keyval = substr($nvpstr, $intial, $keypos);
14371437
$valval = substr($nvpstr, $keypos + 1, $valuepos - $keypos - 1);
1438-
//decoding the respose
1438+
//decoding the response
14391439
$nvpArray[urldecode($keyval)] = urldecode($valval);
14401440
$nvpstr = substr($nvpstr, $valuepos + 1, strlen($nvpstr));
14411441
}

app/code/Magento/Theme/Block/Html/Topmenu.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ protected function _getMenuItemClasses(\Magento\Framework\Data\Tree\Node $item)
309309
$classes[] = 'level' . $item->getLevel();
310310
$classes[] = $item->getPositionClass();
311311

312+
if ($item->getIsCategory()) {
313+
$classes[] = 'category-item';
314+
}
315+
312316
if ($item->getIsFirst()) {
313317
$classes[] = 'first';
314318
}

0 commit comments

Comments
 (0)