Skip to content

Commit 09a8e0f

Browse files
committed
Merge remote-tracking branch 'mainline/2.2' into MC-18487
2 parents 830768c + 2dd1e1a commit 09a8e0f

File tree

264 files changed

+7392
-1394
lines changed

Some content is hidden

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

264 files changed

+7392
-1394
lines changed

CHANGELOG.md

Lines changed: 135 additions & 0 deletions
Large diffs are not rendered by default.

app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="LoginAsAdmin">
1212
<arguments>
1313
<argument name="adminUser" defaultValue="DefaultAdminUser"/>
1414
</arguments>
1515
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
16+
<!-- It sometimes is loading too long for default 10s -->
17+
<waitForPageLoad time="60" stepKey="waitForPageFullyLoaded"/>
1618
<fillField selector="{{AdminLoginFormSection.username}}" userInput="{{adminUser.username}}" stepKey="fillUsername"/>
1719
<fillField selector="{{AdminLoginFormSection.password}}" userInput="{{adminUser.password}}" stepKey="fillPassword"/>
1820
<click selector="{{AdminLoginFormSection.signIn}}" stepKey="clickLogin"/>
1921
<closeAdminNotification stepKey="closeAdminNotification"/>
2022
</actionGroup>
21-
</actionGroups>
23+
</actionGroups>

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,6 @@
567567
<label>Validate HTTP_USER_AGENT</label>
568568
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
569569
</field>
570-
<field id="use_frontend_sid" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
571-
<label>Use SID on Storefront</label>
572-
<comment>Allows customers to stay logged in when switching between different stores.</comment>
573-
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
574-
</field>
575570
</group>
576571
</section>
577572
</system>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,10 @@ define(
246246
return;
247247
}
248248

249-
self.setPaymentPayload(payload);
250-
self.placeOrder();
249+
if (self.validateCardType()) {
250+
self.setPaymentPayload(payload);
251+
self.placeOrder();
252+
}
251253
});
252254
}
253255
},

app/code/Magento/Braintree/view/frontend/web/template/payment/form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<!-- ko template: getTemplate() --><!-- /ko -->
2424
<!--/ko-->
2525
</div>
26-
<form id="co-transparent-form-braintree" class="form" data-bind="" method="post" action="#" novalidate="novalidate">
26+
<form id="co-transparent-form-braintree" class="form" data-bind="afterRender: initHostedFields" method="post" action="#" novalidate="novalidate">
2727
<fieldset data-bind="attr: {class: 'fieldset payment items ccard ' + getCode(), id: 'payment_form_' + getCode()}">
2828
<legend class="legend">
2929
<span><!-- ko i18n: 'Credit Card Information'--><!-- /ko --></span>
@@ -87,7 +87,7 @@
8787
<span><!-- ko i18n: 'Card Verification Number'--><!-- /ko --></span>
8888
</label>
8989
<div class="control _with-tooltip">
90-
<div data-bind="afterRender: initHostedFields, attr: {id: getCode() + '_cc_cid'}" class="hosted-control hosted-cid"></div>
90+
<div data-bind="attr: {id: getCode() + '_cc_cid'}" class="hosted-control hosted-cid"></div>
9191
<div class="hosted-error"><!-- ko i18n: 'Please, enter valid Card Verification Number'--><!-- /ko --></div>
9292

9393
<div class="field-tooltip toggle">

app/code/Magento/Catalog/Model/Category/Attribute/Source/Sortby.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function _getCatalogConfig()
4040
}
4141

4242
/**
43-
* {@inheritdoc}
43+
* @inheritdoc
4444
*/
4545
public function getAllOptions()
4646
{
@@ -49,7 +49,7 @@ public function getAllOptions()
4949
foreach ($this->_getCatalogConfig()->getAttributesUsedForSortBy() as $attribute) {
5050
$this->_options[] = [
5151
'label' => __($attribute['frontend_label']),
52-
'value' => $attribute['attribute_code'],
52+
'value' => $attribute['attribute_code']
5353
];
5454
}
5555
}

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public function getMeta()
217217
}
218218

219219
/**
220-
* Disable fields if they are using default values.
220+
* Add 'use default checkbox' to attributes that can have it.
221221
*
222222
* @param Category $category
223223
* @param array $meta
@@ -357,6 +357,9 @@ public function getAttributesMeta(Type $entityType)
357357
}
358358
if ($attribute->usesSource()) {
359359
$meta[$code]['options'] = $attribute->getSource()->getAllOptions();
360+
foreach ($meta[$code]['options'] as &$option) {
361+
$option['__disableTmpl'] = true;
362+
}
360363
}
361364
}
362365

@@ -542,7 +545,7 @@ public function getDefaultMetaData($result)
542545
}
543546

544547
/**
545-
* List of fields groups and fields.
548+
* List form field sets and fields.
546549
*
547550
* @return array
548551
* @since 101.0.0

app/code/Magento/Catalog/Model/Product/AttributeSet/Options.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
*/
66
namespace Magento\Catalog\Model\Product\AttributeSet;
77

8+
/**
9+
* Attribute Set Options
10+
*/
811
class Options implements \Magento\Framework\Data\OptionSourceInterface
912
{
1013
/**
11-
* @var null|array
14+
* @var array
1215
*/
1316
protected $options;
1417

@@ -25,15 +28,23 @@ public function __construct(
2528
}
2629

2730
/**
28-
* @return array|null
31+
* @inheritDoc
2932
*/
3033
public function toOptionArray()
3134
{
3235
if (null == $this->options) {
3336
$this->options = $this->collectionFactory->create()
3437
->setEntityTypeFilter($this->product->getTypeId())
3538
->toOptionArray();
39+
40+
array_walk(
41+
$this->options,
42+
function (&$option) {
43+
$option['__disableTmpl'] = true;
44+
}
45+
);
3646
}
47+
3748
return $this->options;
3849
}
3950
}

app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
*/
66
namespace Magento\Catalog\Model\Product\Compare;
77

8+
use Magento\Catalog\Model\ProductRepository;
89
use Magento\Catalog\Model\ResourceModel\Product\Compare\Item\Collection;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Exception\NoSuchEntityException;
912

1013
/**
1114
* Product Compare List Model
@@ -51,6 +54,11 @@ class ListCompare extends \Magento\Framework\DataObject
5154
*/
5255
protected $_compareItemFactory;
5356

57+
/**
58+
* @var ProductRepository
59+
*/
60+
private $productRepository;
61+
5462
/**
5563
* Constructor
5664
*
@@ -60,20 +68,23 @@ class ListCompare extends \Magento\Framework\DataObject
6068
* @param \Magento\Customer\Model\Session $customerSession
6169
* @param \Magento\Customer\Model\Visitor $customerVisitor
6270
* @param array $data
71+
* @param ProductRepository|null $productRepository
6372
*/
6473
public function __construct(
6574
\Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory,
6675
\Magento\Catalog\Model\ResourceModel\Product\Compare\Item\CollectionFactory $itemCollectionFactory,
6776
\Magento\Catalog\Model\ResourceModel\Product\Compare\Item $catalogProductCompareItem,
6877
\Magento\Customer\Model\Session $customerSession,
6978
\Magento\Customer\Model\Visitor $customerVisitor,
70-
array $data = []
79+
array $data = [],
80+
ProductRepository $productRepository = null
7181
) {
7282
$this->_compareItemFactory = $compareItemFactory;
7383
$this->_itemCollectionFactory = $itemCollectionFactory;
7484
$this->_catalogProductCompareItem = $catalogProductCompareItem;
7585
$this->_customerSession = $customerSession;
7686
$this->_customerVisitor = $customerVisitor;
87+
$this->productRepository = $productRepository ?: ObjectManager::getInstance()->create(ProductRepository::class);
7788
parent::__construct($data);
7889
}
7990

@@ -82,6 +93,7 @@ public function __construct(
8293
*
8394
* @param int|\Magento\Catalog\Model\Product $product
8495
* @return $this
96+
* @throws \Exception
8597
*/
8698
public function addProduct($product)
8799
{
@@ -90,14 +102,33 @@ public function addProduct($product)
90102
$this->_addVisitorToItem($item);
91103
$item->loadByProduct($product);
92104

93-
if (!$item->getId()) {
105+
if (!$item->getId() && $this->productExists($product)) {
94106
$item->addProductData($product);
95107
$item->save();
96108
}
97109

98110
return $this;
99111
}
100112

113+
/**
114+
* Check product exists.
115+
*
116+
* @param int|\Magento\Catalog\Model\Product $product
117+
* @return bool
118+
*/
119+
private function productExists($product)
120+
{
121+
if ($product instanceof \Magento\Catalog\Model\Product && $product->getId()) {
122+
return true;
123+
}
124+
try {
125+
$product = $this->productRepository->getById((int)$product);
126+
return !empty($product->getId());
127+
} catch (NoSuchEntityException $e) {
128+
return false;
129+
}
130+
}
131+
101132
/**
102133
* Add products to compare list
103134
*

app/code/Magento/Catalog/Model/Product/Gallery/Processor.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,10 @@ public function addImage(
161161
}
162162

163163
$fileName = \Magento\MediaStorage\Model\File\Uploader::getCorrectFileName($pathinfo['basename']);
164-
$dispretionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
165-
$fileName = $dispretionPath . '/' . $fileName;
164+
$dispersionPath = \Magento\MediaStorage\Model\File\Uploader::getDispersionPath($fileName);
165+
$fileName = $dispersionPath . '/' . $fileName;
166166

167-
$fileName = $this->getNotDuplicatedFilename($fileName, $dispretionPath);
167+
$fileName = $this->getNotDuplicatedFilename($fileName, $dispersionPath);
168168

169169
$destinationFile = $this->mediaConfig->getTmpMediaPath($fileName);
170170

@@ -458,27 +458,27 @@ protected function getUniqueFileName($file, $forTmp = false)
458458
* Get filename which is not duplicated with other files in media temporary and media directories
459459
*
460460
* @param string $fileName
461-
* @param string $dispretionPath
461+
* @param string $dispersionPath
462462
* @return string
463463
* @since 101.0.0
464464
*/
465-
protected function getNotDuplicatedFilename($fileName, $dispretionPath)
465+
protected function getNotDuplicatedFilename($fileName, $dispersionPath)
466466
{
467-
$fileMediaName = $dispretionPath . '/'
467+
$fileMediaName = $dispersionPath . '/'
468468
. \Magento\MediaStorage\Model\File\Uploader::getNewFileName($this->mediaConfig->getMediaPath($fileName));
469-
$fileTmpMediaName = $dispretionPath . '/'
469+
$fileTmpMediaName = $dispersionPath . '/'
470470
. \Magento\MediaStorage\Model\File\Uploader::getNewFileName($this->mediaConfig->getTmpMediaPath($fileName));
471471

472472
if ($fileMediaName != $fileTmpMediaName) {
473473
if ($fileMediaName != $fileName) {
474474
return $this->getNotDuplicatedFilename(
475475
$fileMediaName,
476-
$dispretionPath
476+
$dispersionPath
477477
);
478478
} elseif ($fileTmpMediaName != $fileName) {
479479
return $this->getNotDuplicatedFilename(
480480
$fileTmpMediaName,
481-
$dispretionPath
481+
$dispersionPath
482482
);
483483
}
484484
}

0 commit comments

Comments
 (0)