Skip to content

Commit b7f2ba1

Browse files
committed
MC-35065: Catalog pricerules are not working with custom options as expected in Magento 2.3.0 product details page
1 parent 9fa439d commit b7f2ba1

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

app/code/Magento/CatalogRule/Model/Rule.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,4 +895,12 @@ public function getIdentities()
895895
{
896896
return ['price'];
897897
}
898+
899+
/**
900+
* Clear price rules cache.
901+
*/
902+
public function clearPriceRulesData(): void
903+
{
904+
self::$_priceRulesData = [];
905+
}
898906
}

app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithSelectFixedMethodTest.xml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<group value="mtf_migrated"/>
2020
</annotations>
2121
<before>
22-
<!-- Login as Admin -->
23-
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24-
2522
<!-- Create category -->
2623
<createData entity="_defaultCategory" stepKey="createCategory"/>
2724

@@ -33,7 +30,12 @@
3330

3431
<!-- Update all products to have custom options -->
3532
<updateData createDataKey="createProduct1" entity="productWithFixedOptions" stepKey="updateProductWithOptions1"/>
36-
<magentoCron groups="index" stepKey="runCronIndex"/>
33+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
34+
<argument name="indices" value=""/>
35+
</actionGroup>
36+
37+
<!-- Login as Admin -->
38+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
3739
</before>
3840
<after>
3941
<!-- Delete products and category -->
@@ -60,7 +62,9 @@
6062
<actionGroup ref="SelectNotLoggedInCustomerGroupActionGroup" stepKey="selectNotLoggedInCustomerGroup"/>
6163

6264
<!-- Save and apply the new catalog price rule -->
63-
<actionGroup ref="AdminEnableCatalogPriceRuleActionGroup" stepKey="saveAndApplyCatalogPriceRule"/>
65+
<conditionalClick selector="{{AdminNewCatalogPriceRule.active}}" dependentSelector="{{AdminNewCatalogPriceRule.activeIsEnabled}}" visible="false" stepKey="enableActiveBtn"/>
66+
<click selector="{{AdminNewCatalogPriceRule.save}}" stepKey="clickSave"/>
67+
<waitForPageLoad stepKey="waitForSave"/>
6468

6569
<!-- Navigate to category on store front -->
6670
<amOnPage url="{{StorefrontProductPage.url($createCategory.name$)}}" stepKey="goToStorefrontCategoryPage"/>

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/BundlePriceAbstract.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ abstract class BundlePriceAbstract extends \PHPUnit\Framework\TestCase
3030
*/
3131
protected $productCollectionFactory;
3232

33+
/**
34+
* @var \Magento\CatalogRule\Model\RuleFactory
35+
*/
36+
private $ruleFactory;
37+
3338
protected function setUp(): void
3439
{
3540
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
@@ -43,6 +48,7 @@ protected function setUp(): void
4348
true,
4449
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
4550
);
51+
$this->ruleFactory = $this->objectManager->get(\Magento\CatalogRule\Model\RuleFactory::class);
4652
}
4753

4854
/**
@@ -62,6 +68,8 @@ abstract public function getTestCases();
6268
*/
6369
protected function prepareFixture($strategyModifiers, $productSku)
6470
{
71+
$this->ruleFactory->create()->clearPriceRulesData();
72+
6573
$bundleProduct = $this->productRepository->get($productSku);
6674

6775
foreach ($strategyModifiers as $modifier) {

0 commit comments

Comments
 (0)