Skip to content

Commit cd79d01

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-l3/magento2ce into ACP2E-1992
2 parents 0882204 + 0a834cc commit cd79d01

File tree

143 files changed

+5190
-2238
lines changed

Some content is hidden

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

143 files changed

+5190
-2238
lines changed

app/code/Magento/Bundle/Test/Mftf/Data/ProductData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<data key="fixedPriceFormatted">$10.00</data>
3232
<data key="defaultAttribute">Default</data>
3333
</entity>
34+
<entity name="BundleProductWithSlashSku" type="product">
35+
<data key="name">BundleProduct</data>
36+
<data key="sku">bu/ndle</data>
37+
<data key="status">1</data>
38+
</entity>
3439
<entity name="FixedBundleProduct" type="product2">
3540
<data key="name" unique="suffix">FixedBundleProduct</data>
3641
<data key="sku" unique="suffix">fixed-bundle-product</data>

app/code/Magento/Captcha/Test/Mftf/Test/StorefrontCaptchaCheckoutWithEnabledCaptchaTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
</actionGroup>
5858
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="navigateToCheckout"/>
5959
<actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatRate"/>
60-
<actionGroup ref="StorefrontCheckoutForwardFromShippingStepActionGroup" stepKey="goToReview"/>
60+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToReview"/>
6161
<actionGroup ref="AssertCaptchaVisibleOnSecondCheckoutStepActionGroup" stepKey="assertCaptchaIsVisible"/>
6262
<waitForPageLoad stepKey="waitForSpinner"/>
6363
<actionGroup ref="StorefrontFillCaptchaFieldOnCheckoutActionGroup" stepKey="placeOrderWithIncorrectValue">

app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ private function getLinkResolver()
448448
}
449449

450450
/**
451-
* Remove ids of non selected websites from $websiteIds array and return filtered data
451+
* Remove ids of non-selected websites from $websiteIds array and return filtered data
452452
*
453-
* $websiteIds parameter expects array with website ids as keys and 1 (selected) or 0 (non selected) as values
453+
* $websiteIds parameter expects array with website ids as keys and id (selected) or 0 (non-selected) as values
454454
* Only one id (default website ID) will be set to $websiteIds array when the single store mode is turned on
455455
*
456456
* @param array $websiteIds
@@ -461,7 +461,8 @@ private function filterWebsiteIds($websiteIds)
461461
if (!$this->storeManager->isSingleStoreMode()) {
462462
$websiteIds = array_filter((array) $websiteIds);
463463
} else {
464-
$websiteIds[$this->storeManager->getWebsite(true)->getId()] = 1;
464+
$websiteId = $this->storeManager->getWebsite(true)->getId();
465+
$websiteIds[$websiteId] = $websiteId;
465466
}
466467

467468
return $websiteIds;

app/code/Magento/Catalog/Model/Product/Price/Validation/TierPriceValidator.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,19 @@ private function retrieveGroupValue(string $code)
476476
$item = array_shift($items);
477477

478478
if (!$item) {
479+
$this->customerGroupsByCode[$code] = false;
479480
return false;
480481
}
481482

482-
$this->customerGroupsByCode[strtolower($item->getCode())] = $item->getId();
483+
$itemCode = $item->getCode();
484+
$itemId = $item->getId();
485+
486+
if (strtolower($itemCode) !== $code) {
487+
$this->customerGroupsByCode[$code] = false;
488+
return false;
489+
}
490+
491+
$this->customerGroupsByCode[strtolower($itemCode)] = $itemId;
483492
}
484493

485494
return $this->customerGroupsByCode[$code];

app/code/Magento/Catalog/Test/Fixture/Attribute.php

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
use Magento\Catalog\Api\ProductAttributeManagementInterface;
1212
use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
1313
use Magento\Catalog\Model\Product;
14+
use Magento\Catalog\Model\ResourceModel\Attribute as ResourceModelAttribute;
15+
use Magento\Catalog\Model\ResourceModel\Eav\Attribute as EavAttribute;
16+
use Magento\Eav\Model\AttributeFactory;
1417
use Magento\Eav\Setup\EavSetup;
1518
use Magento\Framework\DataObject;
19+
use Magento\TestFramework\Fixture\Api\DataMerger;
1620
use Magento\TestFramework\Fixture\Api\ServiceFactory;
1721
use Magento\TestFramework\Fixture\RevertibleDataFixtureInterface;
1822
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
@@ -30,12 +34,12 @@ class Attribute implements RevertibleDataFixtureInterface
3034
'is_filterable_in_grid' => true,
3135
'position' => 0,
3236
'apply_to' => [],
33-
'is_searchable' => '0',
34-
'is_visible_in_advanced_search' => '0',
35-
'is_comparable' => '0',
36-
'is_used_for_promo_rules' => '0',
37-
'is_visible_on_front' => '0',
38-
'used_in_product_listing' => '0',
37+
'is_searchable' => false,
38+
'is_visible_in_advanced_search' => false,
39+
'is_comparable' => false,
40+
'is_used_for_promo_rules' => false,
41+
'is_visible_on_front' => false,
42+
'used_in_product_listing' => false,
3943
'is_visible' => true,
4044
'scope' => 'store',
4145
'attribute_code' => 'product_attribute%uniqid%',
@@ -49,7 +53,6 @@ class Attribute implements RevertibleDataFixtureInterface
4953
'backend_type' => 'varchar',
5054
'is_unique' => '0',
5155
'validation_rules' => []
52-
5356
];
5457

5558
private const DEFAULT_ATTRIBUTE_SET_DATA = [
@@ -78,29 +81,59 @@ class Attribute implements RevertibleDataFixtureInterface
7881
*/
7982
private $productAttributeManagement;
8083

84+
/**
85+
* @var AttributeFactory
86+
*/
87+
private AttributeFactory $attributeFactory;
88+
89+
/**
90+
* @var DataMerger
91+
*/
92+
private DataMerger $dataMerger;
93+
94+
/**
95+
* @var ResourceModelAttribute
96+
*/
97+
private ResourceModelAttribute $resourceModelAttribute;
98+
8199
/**
82100
* @param ServiceFactory $serviceFactory
83101
* @param ProcessorInterface $dataProcessor
84102
* @param EavSetup $eavSetup
103+
* @param ProductAttributeManagementInterface $productAttributeManagement
104+
* @param AttributeFactory $attributeFactory
105+
* @param DataMerger $dataMerger
106+
* @param ResourceModelAttribute $resourceModelAttribute
85107
*/
86108
public function __construct(
87109
ServiceFactory $serviceFactory,
88110
ProcessorInterface $dataProcessor,
89111
EavSetup $eavSetup,
90-
ProductAttributeManagementInterface $productAttributeManagement
112+
ProductAttributeManagementInterface $productAttributeManagement,
113+
AttributeFactory $attributeFactory,
114+
DataMerger $dataMerger,
115+
ResourceModelAttribute $resourceModelAttribute
91116
) {
92117
$this->serviceFactory = $serviceFactory;
93118
$this->dataProcessor = $dataProcessor;
94119
$this->eavSetup = $eavSetup;
95120
$this->productAttributeManagement = $productAttributeManagement;
121+
$this->attributeFactory = $attributeFactory;
122+
$this->dataMerger = $dataMerger;
123+
$this->resourceModelAttribute = $resourceModelAttribute;
96124
}
97125

98126
/**
99127
* {@inheritdoc}
100128
* @param array $data Parameters. Same format as Attribute::DEFAULT_DATA.
129+
* @return DataObject|null
101130
*/
102131
public function apply(array $data = []): ?DataObject
103132
{
133+
if (array_key_exists('additional_data', $data)) {
134+
return $this->applyAttributeWithAdditionalData($data);
135+
}
136+
104137
$service = $this->serviceFactory->create(ProductAttributeRepositoryInterface::class, 'save');
105138

106139
/**
@@ -139,6 +172,26 @@ public function revert(DataObject $data): void
139172
);
140173
}
141174

175+
/**
176+
* @param array $data Parameters. Same format as Attribute::DEFAULT_DATA.
177+
* @return DataObject|null
178+
*/
179+
private function applyAttributeWithAdditionalData(array $data = []): ?DataObject
180+
{
181+
$defaultData = array_merge(self::DEFAULT_DATA, ['additional_data' => null]);
182+
/** @var EavAttribute $attr */
183+
$attr = $this->attributeFactory->createAttribute(EavAttribute::class, $defaultData);
184+
$mergedData = $this->dataProcessor->process($this, $this->dataMerger->merge($defaultData, $data));
185+
186+
$attributeSetData = $this->prepareAttributeSetData(
187+
array_intersect_key($data, self::DEFAULT_ATTRIBUTE_SET_DATA)
188+
);
189+
190+
$attr->setData(array_merge($mergedData, $attributeSetData));
191+
$this->resourceModelAttribute->save($attr);
192+
return $attr;
193+
}
194+
142195
/**
143196
* Prepare attribute data
144197
*

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494

9595
<!-- 4. Run cron to reindex -->
9696
<wait time="60" stepKey="waitForChanges"/>
97-
<magentoCLI command="cron:run --group index" stepKey="runCron"/>
98-
<magentoCLI command="cron:run --group index" stepKey="runCronTwice"/>
97+
<magentoCron groups="index" stepKey="runCron" />
98+
<magentoCron groups="index" stepKey="runCronTwice" />
9999

100100
<!-- 5. Open category A on Storefront again -->
101101
<actionGroup ref="ReloadPageActionGroup" stepKey="reloadCategoryA"/>
@@ -124,8 +124,8 @@
124124

125125
<!-- 8. Run cron reindex (Ensure that at least one minute passed since last cron run) -->
126126
<wait time="60" stepKey="waitOneMinute"/>
127-
<magentoCLI command="cron:run --group index" stepKey="runCron1"/>
128-
<magentoCLI command="cron:run --group index" stepKey="runCronTwice1"/>
127+
<magentoCron groups="index" stepKey="runCron1" />
128+
<magentoCron groups="index" stepKey="runCronTwice1" />
129129

130130
<!-- 9. Open category A on Storefront again -->
131131
<actionGroup ref="ReloadPageActionGroup" stepKey="refreshCategoryAPage"/>
@@ -180,8 +180,8 @@
180180

181181
<!-- 14. Run cron to reindex (Ensure that at least one minute passed since last cron run) -->
182182
<wait time="60" stepKey="waitMinute"/>
183-
<magentoCLI command="cron:run --group index" stepKey="runCron2"/>
184-
<magentoCLI command="cron:run --group index" stepKey="runCronTwice2"/>
183+
<magentoCron groups="index" stepKey="runCron2" />
184+
<magentoCron groups="index" stepKey="runCronTwice2" />
185185

186186
<!-- 15. Open category B on Storefront -->
187187
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="onPageCategoryB">
@@ -240,8 +240,8 @@
240240

241241
<!-- 17.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) -->
242242
<wait time="60" stepKey="waitForOneMinute"/>
243-
<magentoCLI command="cron:run --group index" stepKey="runCron3"/>
244-
<magentoCLI command="cron:run --group index" stepKey="runCronTwice3"/>
243+
<magentoCron groups="index" stepKey="runCron3" />
244+
<magentoCron groups="index" stepKey="runCronTwice3" />
245245

246246
<!-- 17.15. Open category B on Storefront -->
247247
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openPageCategoryB">
@@ -302,8 +302,8 @@
302302

303303
<!-- 18.14. Run cron to reindex (Ensure that at least one minute passed since last cron run) -->
304304
<wait time="60" stepKey="waitExtraMinute"/>
305-
<magentoCLI command="cron:run --group index" stepKey="runCron4"/>
306-
<magentoCLI command="cron:run --group index" stepKey="runCronTwice4"/>
305+
<magentoCron groups="index" stepKey="runCron4" />
306+
<magentoCron groups="index" stepKey="runCronTwice4" />
307307

308308
<!-- 18.15. Open category B on Storefront -->
309309
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="navigateToPageCategoryB">

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
</actionGroup>
8383

8484
<!-- Run cron -->
85-
<magentoCLI command="cron:run" stepKey="runCron"/>
85+
<magentoCron stepKey="runCron" />
86+
<magentoCron stepKey="runCronTwice" />
8687

8788
<!-- Check product is present in category after cron run -->
8889
<actionGroup ref="AssertProductInStorefrontCategoryPage" stepKey="assertProductInStorefront1">

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ public function initializeDataProvider()
388388
return [
389389
[
390390
'single_store' => false,
391-
'website_ids' => ['1' => 1, '2' => 1],
392-
'expected_website_ids' => ['1' => 1, '2' => 1],
391+
'website_ids' => ['1' => 1, '2' => 2],
392+
'expected_website_ids' => ['1' => 1, '2' => 2],
393393
'links' => [],
394394
'linkTypes' => ['related', 'upsell', 'crosssell'],
395395
'expected_links' => [],
@@ -423,8 +423,8 @@ public function initializeDataProvider()
423423
// Related links
424424
[
425425
'single_store' => false,
426-
'website_ids' => ['1' => 1, '2' => 1],
427-
'expected_website_ids' => ['1' => 1, '2' => 1],
426+
'website_ids' => ['1' => 1, '2' => 2],
427+
'expected_website_ids' => ['1' => 1, '2' => 2],
428428
'links' => [
429429
'related' => [
430430
0 => [
@@ -449,8 +449,8 @@ public function initializeDataProvider()
449449
// Custom link
450450
[
451451
'single_store' => false,
452-
'website_ids' => ['1' => 1, '2' => 1],
453-
'expected_website_ids' => ['1' => 1, '2' => 1],
452+
'website_ids' => ['1' => 1, '2' => 2],
453+
'expected_website_ids' => ['1' => 1, '2' => 2],
454454
'links' => [
455455
'customlink' => [
456456
0 => [
@@ -475,8 +475,8 @@ public function initializeDataProvider()
475475
// Both links
476476
[
477477
'single_store' => false,
478-
'website_ids' => ['1' => 1, '2' => 1],
479-
'expected_website_ids' => ['1' => 1, '2' => 1],
478+
'website_ids' => ['1' => 1, '2' => 2],
479+
'expected_website_ids' => ['1' => 1, '2' => 2],
480480
'links' => [
481481
'related' => [
482482
0 => [
@@ -515,8 +515,8 @@ public function initializeDataProvider()
515515
// Undefined link type
516516
[
517517
'single_store' => false,
518-
'website_ids' => ['1' => 1, '2' => 1],
519-
'expected_website_ids' => ['1' => 1, '2' => 1],
518+
'website_ids' => ['1' => 1, '2' => 2],
519+
'expected_website_ids' => ['1' => 1, '2' => 2],
520520
'links' => [
521521
'related' => [
522522
0 => [

app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function __construct(
9898
public function build(array $args, bool $includeAggregation): SearchCriteriaInterface
9999
{
100100
$searchCriteria = $this->builder->build('products', $args);
101-
$isSearch = !empty($args['search']);
101+
$isSearch = isset($args['search']);
102102
$this->updateRangeFilters($searchCriteria);
103103
if ($includeAggregation) {
104104
$attributeData = $this->eavConfig->getAttribute(Product::ENTITY, 'price');
@@ -122,7 +122,7 @@ public function build(array $args, bool $includeAggregation): SearchCriteriaInte
122122
}
123123

124124
$this->addEntityIdSort($searchCriteria);
125-
$this->addVisibilityFilter($searchCriteria, $isSearch, !empty($args['filter']));
125+
$this->addVisibilityFilter($searchCriteria, $isSearch, !empty($args['filter']['category_id']));
126126

127127
$searchCriteria->setCurrentPage($args['currentPage']);
128128
$searchCriteria->setPageSize($args['pageSize']);

app/code/Magento/CatalogGraphQl/Model/Output/AttributeMetadata.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,32 @@ public function execute(
5252
}
5353

5454
$metadata = [
55-
'is_searchable' => $attribute->getIsSearchable() === "1",
56-
'is_filterable' => $attribute->getIsFilterable() === "1",
5755
'is_comparable' => $attribute->getIsComparable() === "1",
56+
'is_filterable' => $attribute->getIsFilterable() === "1",
57+
'is_filterable_in_search' => $attribute->getIsFilterableInSearch() === "1",
58+
'is_searchable' => $attribute->getIsSearchable() === "1",
5859
'is_html_allowed_on_front' => $attribute->getIsHtmlAllowedOnFront() === "1",
5960
'is_used_for_price_rules' => $attribute->getIsUsedForPriceRules() === "1",
60-
'is_filterable_in_search' => $attribute->getIsFilterableInSearch() === "1",
61-
'used_in_product_listing' => $attribute->getUsedInProductListing() === "1",
62-
'is_wysiwyg_enabled' => $attribute->getIsWysiwygEnabled() === "1",
6361
'is_used_for_promo_rules' => $attribute->getIsUsedForPromoRules() === "1",
64-
'apply_to' => null,
62+
'is_visible_in_advanced_search' => $attribute->getIsVisibleInAdvancedSearch() === "1",
63+
'is_visible_on_front' => $attribute->getIsVisibleOnFront() === "1",
64+
'is_wysiwyg_enabled' => $attribute->getIsWysiwygEnabled() === "1",
65+
'used_in_product_listing' => $attribute->getUsedInProductListing() === "1",
66+
'apply_to' => null
6567
];
6668

6769
if (!empty($attribute->getApplyTo())) {
6870
$metadata['apply_to'] = array_map('strtoupper', $attribute->getApplyTo());
6971
}
7072

73+
if (!empty($attribute->getAdditionalData())) {
74+
$additionalData = json_decode($attribute->getAdditionalData(), true);
75+
$metadata = array_merge(
76+
$metadata,
77+
array_map('strtoupper', $additionalData)
78+
);
79+
}
80+
7181
return $metadata;
7282
}
7383
}

0 commit comments

Comments
 (0)