Skip to content

Commit 5ff1c65

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into BUG#AC-853
2 parents 07f73e8 + 4abe8ff commit 5ff1c65

File tree

54 files changed

+988
-231
lines changed

Some content is hidden

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

54 files changed

+988
-231
lines changed

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/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/CatalogWidget/Model/Rule/Condition/Product.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
2323
{
2424
/**
25-
* {@inheritdoc}
25+
* @var string
2626
*/
2727
protected $elementName = 'parameters';
2828

@@ -32,8 +32,6 @@ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct
3232
protected $joinedAttributes = [];
3333

3434
/**
35-
* Store manager
36-
*
3735
* @var \Magento\Store\Model\StoreManagerInterface
3836
*/
3937
protected $storeManager;
@@ -182,7 +180,7 @@ protected function addGlobalAttribute(
182180
$linkField = $attribute->getEntity()->getLinkField();
183181

184182
$collection->getSelect()->join(
185-
[$alias => $collection->getTable('catalog_product_entity_varchar')],
183+
[$alias => $collection->getTable($attribute->getBackendTable())],
186184
"($alias.$linkField = e.$linkField) AND ($alias.store_id = $storeId)" .
187185
" AND ($alias.attribute_id = {$attribute->getId()})",
188186
[]

app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@
5353
</actionGroup>
5454

5555
<!--Go to Catalog > Categories (choose category where created products)-->
56-
<amOnPage url="{{AdminCategoryPage.url}}" stepKey="onCategoryIndexPage"/>
57-
<waitForPageLoad stepKey="waitForCategoryPageLoadAddProducts" after="onCategoryIndexPage"/>
58-
<click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="clickExpandAll" after="waitForCategoryPageLoadAddProducts"/>
59-
<click selector="{{AdminCategorySidebarTreeSection.categoryInTree(SimpleSubCategory.name)}}" stepKey="clickCategoryLink"/>
60-
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
56+
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="onCategoryIndexPage"/>
57+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageLoadAddProducts"/>
58+
<actionGroup ref="AdminExpandCategoryTreeActionGroup" stepKey="clickExpandAll"/>
59+
<actionGroup ref="AdminCategoriesOpenCategoryActionGroup" stepKey="clickCategoryLink">
60+
<argument name="category" value="SimpleSubCategory"/>
61+
</actionGroup>
62+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForCategoryPageLoad"/>
6163

6264
<!--Content > Add CMS Block: name saved block-->
6365
<waitForElementVisible selector="{{AdminCategoryContentSection.sectionHeader}}" stepKey="waitForContentSection"/>
@@ -75,8 +77,10 @@
7577
<actionGroup ref="AssertAdminCategorySaveSuccessMessageActionGroup" stepKey="seeSuccessMessage"/>
7678

7779
<!--Go to Storefront > category-->
78-
<amOnPage url="$$simplecategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontCategoryPage"/>
79-
<waitForPageLoad stepKey="waitForStorefrontPageLoaded"/>
80+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage">
81+
<argument name="category" value="$$simplecategory$$"/>
82+
</actionGroup>
83+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPageLoaded"/>
8084

8185
<!--Check operators Greater than-->
8286
<dontSeeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('10')}}" stepKey="dontSeeElementByPrice20"/>
@@ -95,8 +99,10 @@
9599
</actionGroup>
96100

97101
<!--Go to Storefront > category-->
98-
<amOnPage url="$$simplecategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontCategoryPage2"/>
99-
<waitForPageLoad stepKey="waitForStorefrontPageLoaded2"/>
102+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage2">
103+
<argument name="category" value="$$simplecategory$$"/>
104+
</actionGroup>
105+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPageLoaded2"/>
100106

101107
<!--Check operators Greater than-->
102108
<seeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('10')}}" stepKey="seeElementByPrice20"/>
@@ -115,8 +121,10 @@
115121
</actionGroup>
116122

117123
<!--Go to Storefront > category-->
118-
<amOnPage url="$$simplecategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontCategoryPage3"/>
119-
<waitForPageLoad stepKey="waitForStorefrontPageLoaded3"/>
124+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage3">
125+
<argument name="category" value="$$simplecategory$$"/>
126+
</actionGroup>
127+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPageLoaded3"/>
120128

121129
<!--Check operators Greater than-->
122130
<dontSeeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('10')}}" stepKey="dontSeeElementByPrice20s"/>
@@ -135,8 +143,10 @@
135143
</actionGroup>
136144

137145
<!--Go to Storefront > category-->
138-
<amOnPage url="$$simplecategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontCategoryPage4"/>
139-
<waitForPageLoad stepKey="waitForStorefrontPageLoaded4"/>
146+
<actionGroup ref="StorefrontNavigateCategoryPageActionGroup" stepKey="goToStorefrontCategoryPage4">
147+
<argument name="category" value="$$simplecategory$$"/>
148+
</actionGroup>
149+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForStorefrontPageLoaded4"/>
140150

141151
<!--Check operators Greater than-->
142152
<seeElement selector="{{InsertWidgetSection.checkElementStorefrontByPrice('10')}}" stepKey="seeElementByPrice20s"/>

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ class Dob extends AbstractWidget
2828
const MAX_DATE_RANGE_KEY = 'date_range_max';
2929

3030
/**
31-
* Date inputs
32-
*
3331
* @var array
3432
*/
3533
protected $_dateInputs = [];
@@ -422,7 +420,8 @@ public function getTranslatedCalendarConfigJson(): string
422420
'monthNamesShort' => array_values(iterator_to_array($monthsData['format']['abbreviated'])),
423421
'dayNames' => array_values(iterator_to_array($daysData['format']['wide'])),
424422
'dayNamesShort' => array_values(iterator_to_array($daysData['format']['abbreviated'])),
425-
'dayNamesMin' => array_values(iterator_to_array($daysData['format']['short'])),
423+
'dayNamesMin' =>
424+
array_values(iterator_to_array(($daysData['format']['short']) ?: $daysData['format']['abbreviated'])),
426425
]
427426
);
428427
}

app/code/Magento/Eav/Model/Entity/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,12 @@ public function getBackendTypeByInput($type)
356356
case 'text':
357357
case 'gallery':
358358
case 'media_image':
359-
case 'multiselect':
360359
$field = 'varchar';
361360
break;
362361

363362
case 'image':
364363
case 'textarea':
364+
case 'multiselect':
365365
$field = 'text';
366366
break;
367367

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ private function clearSelectedOptionInEntities(AbstractModel $object, int $optio
523523
$where = $connection->quoteInto('attribute_id = ?', $attributeId);
524524
$update = [];
525525

526-
if ($object->getBackendType() === 'varchar') {
526+
if ($object->getBackendType() === 'text') {
527527
$where.= ' AND ' . $connection->prepareSqlCondition('value', ['finset' => $optionId]);
528528
$concat = $connection->getConcatSql(["','", 'value', "','"]);
529529
$expr = $connection->quoteInto(

app/code/Magento/Eav/Test/Unit/Model/Entity/AttributeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static function dataGetBackendTypeByInput()
6262
['text', 'varchar'],
6363
['gallery', 'varchar'],
6464
['media_image', 'varchar'],
65-
['multiselect', 'varchar'],
65+
['multiselect', 'text'],
6666
['image', 'text'],
6767
['textarea', 'text'],
6868
['date', 'datetime'],

0 commit comments

Comments
 (0)