Skip to content

Commit 67d6069

Browse files
Merge branch '2.4-develop' into AC-1120
2 parents cc03564 + 203a44f commit 67d6069

File tree

171 files changed

+23385
-17820
lines changed

Some content is hidden

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

171 files changed

+23385
-17820
lines changed

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22
/**
3-
* Default application path for backend area
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
86
namespace Magento\Backend\App;
97

108
/**
9+
* Default application path for backend area
10+
*
1111
* @api
1212
* @since 100.0.2
1313
*/
@@ -24,7 +24,11 @@ class DefaultPath implements \Magento\Framework\App\DefaultPathInterface
2424
*/
2525
public function __construct(\Magento\Backend\App\ConfigInterface $config)
2626
{
27-
$pathParts = explode('/', $config->getValue('web/default/admin'));
27+
$pathConfigValue = $config->getValue('web/default/admin') ?? '';
28+
$pathParts = [];
29+
if ($pathConfigValue) {
30+
$pathParts = explode('/', $pathConfigValue);
31+
}
2832

2933
$this->_parts = [
3034
'area' => isset($pathParts[0]) ? $pathParts[0] : '',

app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use Magento\Framework\View\Helper\SecureHtmlRenderer;
1919
<?php foreach ($tabs as $_tab): ?>
2020
<?php $tabId = $block->getTabId($_tab) ?>
2121
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
22-
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
22+
($_tab->getClass() !== null ? (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') : '') ?>
2323
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
2424
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
2525
'#' . $tabId . '_content' :

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/Source.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function _getIndexableAttributes($multiSelect)
105105
);
106106

107107
if ($multiSelect == true) {
108-
$select->where('ea.backend_type = ?', 'varchar')->where('ea.frontend_input = ?', 'multiselect');
108+
$select->where('ea.backend_type = ?', 'text')->where('ea.frontend_input = ?', 'multiselect');
109109
} else {
110110
$select->where('ea.backend_type = ?', 'int')->where('ea.frontend_input IN( ? )', ['select', 'boolean']);
111111
}
@@ -303,14 +303,14 @@ protected function _prepareMultiselectIndex($entityIds = null, $attributeId = nu
303303
// prepare get multiselect values query
304304
$productValueExpression = $connection->getCheckSql('pvs.value_id > 0', 'pvs.value', 'pvd.value');
305305
$select = $connection->select()->from(
306-
['pvd' => $this->getTable('catalog_product_entity_varchar')],
306+
['pvd' => $this->getTable('catalog_product_entity_text')],
307307
[]
308308
)->join(
309309
['cs' => $this->getTable('store')],
310310
'',
311311
[]
312312
)->joinLeft(
313-
['pvs' => $this->getTable('catalog_product_entity_varchar')],
313+
['pvs' => $this->getTable('catalog_product_entity_text')],
314314
"pvs.{$productIdField} = pvd.{$productIdField} AND pvs.attribute_id = pvd.attribute_id"
315315
. ' AND pvs.store_id=cs.store_id',
316316
[]
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Catalog\Setup\Patch\Data;
8+
9+
use Magento\Catalog\Model\Product;
10+
use Magento\Eav\Setup\EavSetup;
11+
use Magento\Eav\Setup\EavSetupFactory;
12+
use Magento\Framework\Exception\LocalizedException;
13+
use Magento\Framework\Setup\ModuleDataSetupInterface;
14+
use Magento\Framework\Setup\Patch\DataPatchInterface;
15+
16+
class UpdateMultiselectAttributesBackendTypes implements DataPatchInterface
17+
{
18+
/**
19+
* @var ModuleDataSetupInterface
20+
*/
21+
private $dataSetup;
22+
/**
23+
* @var EavSetupFactory
24+
*/
25+
private $eavSetupFactory;
26+
27+
/**
28+
* MigrateMultiselectAttributesData constructor.
29+
* @param ModuleDataSetupInterface $dataSetup
30+
* @param EavSetupFactory $eavSetupFactory
31+
*/
32+
public function __construct(
33+
ModuleDataSetupInterface $dataSetup,
34+
EavSetupFactory $eavSetupFactory
35+
) {
36+
$this->dataSetup = $dataSetup;
37+
$this->eavSetupFactory = $eavSetupFactory;
38+
}
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
public static function getDependencies()
44+
{
45+
return [];
46+
}
47+
48+
/**
49+
* @inheritdoc
50+
*/
51+
public function getAliases()
52+
{
53+
return [];
54+
}
55+
56+
/**
57+
* @inheritdoc
58+
*/
59+
public function apply()
60+
{
61+
$this->dataSetup->startSetup();
62+
63+
$connection = $this->dataSetup->getConnection();
64+
$attributeTable = $connection->getTableName('eav_attribute');
65+
/** @var EavSetup $eavSetup */
66+
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->dataSetup]);
67+
$entityTypeId = $eavSetup->getEntityTypeId(Product::ENTITY);
68+
$attributesToMigrate = $connection->fetchCol(
69+
$connection
70+
->select()
71+
->from($attributeTable, ['attribute_id'])
72+
->where('entity_type_id = ?', $entityTypeId)
73+
->where('backend_type = ?', 'varchar')
74+
->where('frontend_input = ?', 'multiselect')
75+
);
76+
77+
$varcharTable = $connection->getTableName('catalog_product_entity_varchar');
78+
$textTable = $connection->getTableName('catalog_product_entity_text');
79+
$varcharTableDataSql = $connection
80+
->select()
81+
->from($varcharTable)
82+
->where('attribute_id in (?)', $attributesToMigrate);
83+
$dataToMigrate = array_map(static function ($row) {
84+
$row['value_id'] = null;
85+
return $row;
86+
}, $connection->fetchAll($varcharTableDataSql));
87+
88+
foreach (array_chunk($dataToMigrate, 2000) as $dataChunk) {
89+
$connection->insertMultiple($textTable, $dataChunk);
90+
}
91+
92+
$connection->query($connection->deleteFromSelect($varcharTableDataSql, $varcharTable));
93+
94+
foreach ($attributesToMigrate as $attributeId) {
95+
$eavSetup->updateAttribute($entityTypeId, $attributeId, 'backend_type', 'text');
96+
}
97+
98+
$this->dataSetup->endSetup();
99+
100+
return $this;
101+
}
102+
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
2222
<attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/>
2323
<comment userInput="BIC workaround" stepKey="waitForAjaxUpload"/>
24-
<waitForPageLoad stepKey="waitForLoading"/>
24+
<waitForElementVisible selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="waitForLoading"/>
2525
<grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/>
2626
<assertRegExp stepKey="assertEquals" message="pass">
2727
<expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveAndNotIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,26 @@
3333
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
3434
<!--Create subcategory under parent category -->
3535
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
36-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" stepKey="selectCategory"/>
37-
<waitForPageLoad stepKey="waitForPageToLoad"/>
36+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCategory">
37+
<argument name="category" value="$$createCategory$$"/>
38+
</actionGroup>
39+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad"/>
3840
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
3941
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
4042
<checkOption selector="{{AdminCategoryBasicFieldSection.IncludeInMenu}}" stepKey="enableIncludeInMenu"/>
4143
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/>
4244
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveSubCategory"/>
43-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
45+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeSuccessMessage">
46+
<argument name="message" value="You saved the category."/>
47+
</actionGroup>
4448
<!-- Verify Parent Category and Sub category is not visible in navigation menu -->
4549
<amOnPage url="$$createCategory.custom_attributes[url_key]$$/{{SimpleSubCategory.urlKey}}.html" stepKey="openCategoryStoreFrontPage"/>
4650
<waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/>
47-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnStoreNavigationBar"/>
48-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="dontSeeSubCategoryOnStoreNavigation"/>
51+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeCategoryOnStoreNavigationBar">
52+
<argument name="categoryName" value="$$createCategory.name$$"/>
53+
</actionGroup>
54+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeSubCategoryOnStoreNavigation">
55+
<argument name="categoryName" value="{{SimpleSubCategory.name}}"/>
56+
</actionGroup>
4957
</test>
5058
</tests>

app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveCategoryAndSubcategoryIsNotVisibleInNavigationMenuTest.xml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,26 @@
3232
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="openAdminCategoryIndexPage"/>
3333
<!--Create subcategory under parent category -->
3434
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickOnExpandTree"/>
35-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree($$createCategory.name$$)}}" stepKey="selectCategory"/>
36-
<waitForPageLoad stepKey="waitForPageToLoad"/>
35+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="selectCategory">
36+
<argument name="category" value="$$createCategory$$"/>
37+
</actionGroup>
38+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForPageToLoad"/>
3739
<click selector="{{AdminCategorySidebarActionSection.AddSubcategoryButton}}" stepKey="clickOnAddSubCategoryButton"/>
3840
<checkOption selector="{{AdminCategoryBasicFieldSection.EnableCategory}}" stepKey="enableCategory"/>
3941
<checkOption selector="{{AdminCategoryBasicFieldSection.IncludeInMenu}}" stepKey="enableIncludeInMenu"/>
4042
<fillField selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{SimpleSubCategory.name}}" stepKey="addSubCategoryName"/>
4143
<actionGroup ref="AdminSaveCategoryActionGroup" stepKey="saveSubCategory"/>
42-
<seeElement selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="seeSuccessMessage"/>
44+
<actionGroup ref="AssertMessageInAdminPanelActionGroup" stepKey="seeSuccessMessage">
45+
<argument name="message" value="You saved the category."/>
46+
</actionGroup>
4347
<!-- Verify Parent Category and Sub category is not visible in navigation menu -->
4448
<amOnPage url="$$createCategory.custom_attributes[url_key]$$/{{SimpleSubCategory.urlKey}}.html" stepKey="openCategoryStoreFrontPage"/>
4549
<waitForPageLoad stepKey="waitForCategoryStoreFrontPageToLoad"/>
46-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName($$createCategory.name$$)}}" stepKey="dontSeeCategoryOnStoreNavigationBar"/>
47-
<dontSeeElement selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="dontSeeSubCategoryOnStoreNavigation"/>
50+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeCategoryOnStoreNavigationBar">
51+
<argument name="categoryName" value="$$createCategory.name$$"/>
52+
</actionGroup>
53+
<actionGroup ref="StorefrontAssertCategoryNameIsNotShownInMenuActionGroup" stepKey="dontSeeSubCategoryOnStoreNavigation">
54+
<argument name="categoryName" value="{{SimpleSubCategory.name}}"/>
55+
</actionGroup>
4856
</test>
4957
</tests>

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ define([
1616
url: '',
1717
data: [],
1818
tree: {
19-
plugins: ['themes', 'json_data', 'ui', 'hotkeys'],
20-
themes: {
21-
theme: 'default',
22-
dots: false,
23-
icons: true
19+
core: {
20+
themes: {
21+
dots: false
22+
}
2423
}
2524
}
2625
},
@@ -33,27 +32,8 @@ define([
3332
{},
3433
options.tree,
3534
{
36-
'json_data': {
37-
ajax: {
38-
url: options.url,
39-
type: 'POST',
40-
success: $.proxy(function (nodes) {
41-
return this._convertDataNodes(nodes);
42-
}, this),
43-
44-
/**
45-
* @param {HTMLElement} node
46-
* @return {Object}
47-
*/
48-
data: function (node) {
49-
return {
50-
id: $(node).data('id'),
51-
'form_key': window.FORM_KEY
52-
};
53-
}
54-
},
55-
data: this._convertData(options.data).children,
56-
'progressive_render': true
35+
core: {
36+
data: this._convertData(this.options.data).children
5737
}
5838
}
5939
);
@@ -68,9 +48,9 @@ define([
6848
* @private
6949
*/
7050
_selectNode: function (event, data) {
71-
var node = data.rslt.obj.data();
51+
var node = data.node;
7252

73-
if (!node.disabled) {
53+
if (!node.state.disabled) {
7454
window.location = window.location + '/' + node.id;
7555
} else {
7656
event.preventDefault();
@@ -85,7 +65,7 @@ define([
8565
_convertDataNodes: function (nodes) {
8666
var nodesData = [];
8767

88-
nodes.forEach(function (node) {
68+
nodes.children.forEach(function (node) {
8969
nodesData.push(this._convertData(node));
9070
}, this);
9171

@@ -104,25 +84,19 @@ define([
10484
if (!node) {
10585
return result;
10686
}
87+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
10788
result = {
108-
data: {
109-
title: utils.unescape(node.name) + ' (' + node['product_count'] + ')'
89+
id: node.id,
90+
text: utils.unescape(node.name) + ' (' + node.product_count + ')',
91+
li_attr: {
92+
class: node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
11093
},
111-
attr: {
112-
'class': node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
113-
},
114-
metadata: {
115-
id: node.id,
116-
disabled: node.disabled
94+
state: {
95+
disabled: node.disabled,
96+
opened: !!node.children_count && node.expanded
11797
}
11898
};
119-
120-
if (node['children_count'] && !node.expanded) {
121-
result.state = 'closed';
122-
} else {
123-
result.state = 'open';
124-
}
125-
99+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
126100
if (node.children) {
127101
result.children = [];
128102
$.each(node.children, function () {

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37-
$(this.options.addToCartButtonSelector).attr('disabled', false);
37+
$(this.options.addToCartButtonSelector).prop('disabled', false);
3838
},
3939

4040
/**
@@ -101,7 +101,7 @@ define([
101101
formData = new FormData(form[0]);
102102

103103
$.ajax({
104-
url: form.attr('action'),
104+
url: form.prop('action'),
105105
data: formData,
106106
type: 'post',
107107
dataType: 'json',
@@ -201,7 +201,7 @@ define([
201201

202202
addToCartButton.addClass(this.options.addToCartButtonDisabledClass);
203203
addToCartButton.find('span').text(addToCartButtonTextWhileAdding);
204-
addToCartButton.attr('title', addToCartButtonTextWhileAdding);
204+
addToCartButton.prop('title', addToCartButtonTextWhileAdding);
205205
},
206206

207207
/**
@@ -213,14 +213,14 @@ define([
213213
addToCartButton = $(form).find(this.options.addToCartButtonSelector);
214214

215215
addToCartButton.find('span').text(addToCartButtonTextAdded);
216-
addToCartButton.attr('title', addToCartButtonTextAdded);
216+
addToCartButton.prop('title', addToCartButtonTextAdded);
217217

218218
setTimeout(function () {
219219
var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Cart');
220220

221221
addToCartButton.removeClass(self.options.addToCartButtonDisabledClass);
222222
addToCartButton.find('span').text(addToCartButtonTextDefault);
223-
addToCartButton.attr('title', addToCartButtonTextDefault);
223+
addToCartButton.prop('title', addToCartButtonTextDefault);
224224
}, 1000);
225225
}
226226
});

0 commit comments

Comments
 (0)