Skip to content

Commit 590a806

Browse files
committed
Merge remote-tracking branch 'performance/ims-phase1' into CABPI-197
2 parents 765ffb8 + 0d746ef commit 590a806

File tree

10 files changed

+561
-30
lines changed

10 files changed

+561
-30
lines changed

app/code/Magento/BundleGraphQl/Model/Resolver/Order/Item/BundleOptions.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class BundleOptions implements ResolverInterface
3030
private const OPTION_TYPE = 'bundle';
3131

3232
/**
33-
* Serializer
34-
*
3533
* @var Json
3634
*/
3735
private $serializer;
@@ -148,7 +146,7 @@ private function formatBundleOptionItems(
148146
$optionDetails = [
149147
self::OPTION_TYPE,
150148
$bundleChildAttributes['option_id'],
151-
implode(',', $options),
149+
is_array($options) ? implode(',', $options) : $options,
152150
(int) $childOrderItemOptions['info_buyRequest']['qty']
153151
];
154152

app/code/Magento/Catalog/Model/Indexer/Product/Price.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ public function __construct(
6666
public function execute($ids)
6767
{
6868
$this->_productPriceIndexerRows->execute($ids);
69-
$this->cacheContext->registerEntities(ProductModel::CACHE_TAG, $ids);
7069
}
7170

7271
/**

app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Rows.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
*/
66
namespace Magento\Catalog\Model\Indexer\Product\Price\Action;
77

8-
use Magento\Directory\Model\CurrencyFactory;
98
use Magento\Catalog\Model\Indexer\Product\Price\DimensionCollectionFactory;
109
use Magento\Catalog\Model\Indexer\Product\Price\TableMaintainer;
10+
use Magento\Catalog\Model\Product;
1111
use Magento\Catalog\Model\Product\Type;
1212
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice;
1313
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\Factory;
1414
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\TierPrice;
15+
use Magento\Directory\Model\CurrencyFactory;
1516
use Magento\Framework\App\Config\ScopeConfigInterface;
17+
use Magento\Framework\App\ObjectManager;
18+
use Magento\Framework\Indexer\CacheContext;
1619
use Magento\Framework\Stdlib\DateTime;
1720
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1821
use Magento\Store\Model\StoreManagerInterface;
@@ -34,6 +37,11 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction
3437
*/
3538
private $batchSize;
3639

40+
/**
41+
* @var CacheContext
42+
*/
43+
private CacheContext $cacheContext;
44+
3745
/**
3846
* @param ScopeConfigInterface $config
3947
* @param StoreManagerInterface $storeManager
@@ -47,6 +55,7 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Price\AbstractAction
4755
* @param DimensionCollectionFactory|null $dimensionCollectionFactory
4856
* @param TableMaintainer|null $tableMaintainer
4957
* @param int|null $batchSize
58+
* @param CacheContext|null $cacheContext
5059
* @SuppressWarnings(PHPMD.NPathComplexity) Added to backward compatibility with abstract class
5160
* @SuppressWarnings(PHPMD.CyclomaticComplexity) Added to backward compatibility with abstract class
5261
* @SuppressWarnings(PHPMD.ExcessiveParameterList) Added to backward compatibility with abstract class
@@ -63,7 +72,8 @@ public function __construct(
6372
TierPrice $tierPriceIndexResource = null,
6473
DimensionCollectionFactory $dimensionCollectionFactory = null,
6574
TableMaintainer $tableMaintainer = null,
66-
?int $batchSize = null
75+
?int $batchSize = null,
76+
CacheContext $cacheContext = null
6777
) {
6878
parent::__construct(
6979
$config,
@@ -79,6 +89,7 @@ public function __construct(
7989
$tableMaintainer
8090
);
8191
$this->batchSize = $batchSize ?? self::BATCH_SIZE;
92+
$this->cacheContext = $cacheContext ?? ObjectManager::getInstance()->get(CacheContext::class);
8293
}
8394

8495
/**
@@ -101,7 +112,7 @@ public function execute($ids)
101112
$currentBatch[] = $id;
102113
if (++$i === $this->batchSize) {
103114
try {
104-
$this->_reindexRows($currentBatch);
115+
$this->cacheContext->registerEntities(Product::CACHE_TAG, $this->_reindexRows($currentBatch));
105116
} catch (\Exception $e) {
106117
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
107118
}
@@ -112,7 +123,7 @@ public function execute($ids)
112123

113124
if (!empty($currentBatch)) {
114125
try {
115-
$this->_reindexRows($currentBatch);
126+
$this->cacheContext->registerEntities(Product::CACHE_TAG, $this->_reindexRows($currentBatch));
116127
} catch (\Exception $e) {
117128
throw new \Magento\Framework\Exception\LocalizedException(__($e->getMessage()), $e);
118129
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCheckConfigurableProductPriceWhenChildProductPriceUpdatedTest">
11+
<annotations>
12+
<stories value="Configurable Product"/>
13+
<title value="Check price of configurable product when one child product price is updated"/>
14+
<description value="Login as admin and check the configurable product price when one child product child product price is updated"/>
15+
<severity value="CRITICAL"/>
16+
<group value="product"/>
17+
</annotations>
18+
<before>
19+
<!-- Login as Admin -->
20+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginToAdminPanel"/>
21+
22+
<!-- Create Default Category -->
23+
<createData entity="_defaultCategory" stepKey="createCategory"/>
24+
25+
<!-- Create an attribute with two options to be used in the child product -->
26+
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
27+
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
28+
<requiredEntity createDataKey="createConfigProductAttribute"/>
29+
</createData>
30+
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
31+
<requiredEntity createDataKey="createConfigProductAttribute"/>
32+
</createData>
33+
34+
<!-- Add the attribute just created to default attribute set -->
35+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
36+
<requiredEntity createDataKey="createConfigProductAttribute"/>
37+
</createData>
38+
39+
<!-- Get the first option of the attribute created -->
40+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
41+
<requiredEntity createDataKey="createConfigProductAttribute"/>
42+
</getData>
43+
44+
<!-- Get the second option of the attribute created -->
45+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
46+
<requiredEntity createDataKey="createConfigProductAttribute"/>
47+
</getData>
48+
49+
<!-- Create Configurable product -->
50+
<createData entity="BaseConfigurableProduct" stepKey="createConfigProduct">
51+
<requiredEntity createDataKey="createCategory"/>
52+
</createData>
53+
54+
<!-- Create a simple product and give it the attribute with the first option -->
55+
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
56+
<requiredEntity createDataKey="createConfigProductAttribute"/>
57+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
58+
<field key="price">10.00</field>
59+
</createData>
60+
61+
<!--Create a simple product and give it the attribute with the second option -->
62+
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
63+
<requiredEntity createDataKey="createConfigProductAttribute"/>
64+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
65+
<field key="price">20.00</field>
66+
</createData>
67+
68+
<!-- Create the configurable product -->
69+
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
70+
<requiredEntity createDataKey="createConfigProduct"/>
71+
<requiredEntity createDataKey="createConfigProductAttribute"/>
72+
<requiredEntity createDataKey="getConfigAttributeOption1"/>
73+
<requiredEntity createDataKey="getConfigAttributeOption2"/>
74+
</createData>
75+
76+
<!-- Add the first simple product to the configurable product -->
77+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
78+
<requiredEntity createDataKey="createConfigProduct"/>
79+
<requiredEntity createDataKey="createConfigChildProduct1"/>
80+
</createData>
81+
82+
<!-- Add the second simple product to the configurable product -->
83+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
84+
<requiredEntity createDataKey="createConfigProduct"/>
85+
<requiredEntity createDataKey="createConfigChildProduct2"/>
86+
</createData>
87+
88+
<!--Open Index Management Page and Select Index mode "Update by Schedule" -->
89+
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="schedule" />
90+
91+
<!-- Run cron -->
92+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
93+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
94+
95+
<!-- Wait till cron job runs for schedule updates -->
96+
<wait time="60" stepKey="waitForUpdateStarts"/>
97+
</before>
98+
<after>
99+
<magentoCLI stepKey="setIndexerMode" command="indexer:set-mode" arguments="realtime" />
100+
<comment userInput="Adding the comment to replace CliIndexerReindexActionGroup action group ('indexer:reindex' commands) for preserving Backward Compatibility" stepKey="indexerReindex"/>
101+
102+
<!-- Delete Created Data -->
103+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
104+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
105+
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
106+
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
107+
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/>
108+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
109+
110+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
111+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
112+
</after>
113+
114+
<!-- Open Product in Store Front Page -->
115+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront">
116+
<argument name="product" value="$createConfigProduct$"/>
117+
</actionGroup>
118+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad"/>
119+
120+
<!-- Verify category,Configurable product and initial price -->
121+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage">
122+
<argument name="categoryName" value="$$createCategory.name$$"/>
123+
</actionGroup>
124+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront">
125+
<argument name="productName" value="$$createConfigProduct.name$$"/>
126+
</actionGroup>
127+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeInitialPriceInStoreFront">
128+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
129+
</actionGroup>
130+
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront">
131+
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
132+
</actionGroup>
133+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront">
134+
<argument name="productStockStatus" value="In Stock"/>
135+
</actionGroup>
136+
137+
<!-- Verify First Child Product attribute option is displayed -->
138+
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1"/>
139+
140+
<!-- Select product Attribute option1, option2 and option3 and verify changes in the price -->
141+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1">
142+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
143+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
144+
</actionGroup>
145+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFront">
146+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
147+
</actionGroup>
148+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption2">
149+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
150+
<argument name="optionLabel" value="$$getConfigAttributeOption2.label$$"/>
151+
</actionGroup>
152+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct2PriceInStoreFront">
153+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
154+
</actionGroup>
155+
<!-- Open Product Index Page and Filter First Child product -->
156+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="navigateToProductIndex"/>
157+
<comment userInput="Comment is added to preserve the step key for backward compatibility" stepKey="filterProduct"/>
158+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanFullPageCache">
159+
<argument name="tags" value="full_page"/>
160+
</actionGroup>
161+
<actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="selectFirstRow">
162+
<argument name="productId" value="$$createConfigChildProduct1.id$$"/>
163+
</actionGroup>
164+
<waitForPageLoad stepKey="waitForProductPageToLoad"/>
165+
166+
<updateData entity="SimpleProductUpdatePrice90" createDataKey="createConfigChildProduct1" stepKey="updateSimpleProductOne"/>
167+
168+
<!-- Run cron -->
169+
<magentoCron stepKey="runIndexCronJobs" groups="index"/>
170+
<comment userInput="Adding the comment to replace CliCacheFlushActionGroup action group ('cache:flush' command) for preserving Backward Compatibility" stepKey="flushCache"/>
171+
172+
<!-- Wait till cron job runs for schedule updates -->
173+
<wait time="60" stepKey="waitForUpdateStarts"/>
174+
175+
<!-- Open Product Store Front Page -->
176+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductInStoreFront1">
177+
<argument name="product" value="$createConfigProduct$"/>
178+
</actionGroup>
179+
<comment userInput="CommentConfigurableProductTwoOptions is added to preserve the step key for backward compatibility" stepKey="waitForProductToLoad1"/>
180+
181+
<!-- Verify category,configurable product and updated price -->
182+
<actionGroup ref="StorefrontAssertCategoryNameIsShownInMenuActionGroup" stepKey="seeCategoryInFrontPage1">
183+
<argument name="categoryName" value="$$createCategory.name$$"/>
184+
</actionGroup>
185+
<actionGroup ref="StorefrontAssertProductNameOnProductPageActionGroup" stepKey="seeProductNameInStoreFront1">
186+
<argument name="productName" value="$$createConfigProduct.name$$"/>
187+
</actionGroup>
188+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeUpdatedProductPriceInStoreFront">
189+
<argument name="productPrice" value="$$createConfigChildProduct2.price$$"/>
190+
</actionGroup>
191+
<actionGroup ref="StorefrontAssertProductSkuOnProductPageActionGroup" stepKey="seeProductSkuInStoreFront1">
192+
<argument name="productSku" value="$$createConfigProduct.sku$$"/>
193+
</actionGroup>
194+
<actionGroup ref="AssertStorefrontProductStockStatusOnProductPageActionGroup" stepKey="seeProductStatusInStoreFront1">
195+
<argument name="productStockStatus" value="In Stock"/>
196+
</actionGroup>
197+
198+
<!-- Verify product Attribute Option1 is displayed -->
199+
<see selector="{{StorefrontProductInfoMainSection.productOptionSelect($$createConfigProductAttribute.default_value$$)}}" userInput="$$getConfigAttributeOption1.label$$" stepKey="seeOption1AfterUpdate"/>
200+
201+
<!--Select product Attribute option1 and verify changes in the price -->
202+
<actionGroup ref="StorefrontProductPageSelectDropDownOptionValueActionGroup" stepKey="selectOption1AfterUpdate">
203+
<argument name="attributeLabel" value="$$createConfigProductAttribute.default_value$$"/>
204+
<argument name="optionLabel" value="$$getConfigAttributeOption1.label$$"/>
205+
</actionGroup>
206+
<actionGroup ref="StorefrontAssertProductPriceOnProductPageActionGroup" stepKey="seeChildProduct1PriceInStoreFrontAfterUpdate">
207+
<argument name="productPrice" value="$$createConfigChildProduct1.price$$"/>
208+
</actionGroup>
209+
</test>
210+
</tests>

app/code/Magento/Elasticsearch/Model/DataProvider/Base/Suggestions.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ private function addSuggestFields($searchQuery, $searchSuggestionsCount)
226226
[
227227
'field' => $field,
228228
'min_word_length' => 3,
229-
'min_doc_freq' => 1,
230229
]
231230
],
232231
],

0 commit comments

Comments
 (0)