Skip to content

Commit d4c84b6

Browse files
committed
ACP2E-23: [Magento Cloud] Error message in PDP disappearing quickly
1 parent c5883e1 commit d4c84b6

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddProductToCartVerifyThatErrorMessageShouldNotDisappearTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
<deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/>
3333
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
3434
<magentoCLI command="config:set {{DisableSynchronizeWidgetProductsWithBackendStorage.path}} {{DisableSynchronizeWidgetProductsWithBackendStorage.value}}" stepKey="setDisableSynchronizeWidgetProductsWithBackendStorage"/>
35+
<!--Reindex and flush cache-->
36+
<magentoCLI command="cron:run --group=index" stepKey="runCronReindex"/>
3537
</after>
3638

3739
<waitForPageLoad time="60" stepKey="waitForPageLoad"/>

app/code/Magento/Theme/CustomerData/Messages.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,32 @@ class Messages implements SectionSourceInterface
4242
*/
4343
private $appConfig;
4444

45+
/**
46+
* @var Synchronizer
47+
*/
48+
private $synchronizer;
49+
4550
/**
4651
* Constructor
4752
*
4853
* @param MessageManager $messageManager
4954
* @param InterpretationStrategyInterface $interpretationStrategy
5055
* @param RequestInterface $request
5156
* @param Config $appConfig
57+
* @param Synchronizer $synchronizer
5258
*/
5359
public function __construct(
5460
MessageManager $messageManager,
5561
InterpretationStrategyInterface $interpretationStrategy,
5662
?RequestInterface $request = null,
57-
?Config $appConfig = null
63+
?Config $appConfig = null,
64+
?Synchronizer $synchronizer = null
5865
) {
5966
$this->messageManager = $messageManager;
6067
$this->interpretationStrategy = $interpretationStrategy;
6168
$this->request = $request ?: ObjectManager::getInstance()->get(RequestInterface::class);
6269
$this->appConfig = $appConfig ?: ObjectManager::getInstance()->get(Config::class);
70+
$this->synchronizer = $synchronizer ?: ObjectManager::getInstance()->get(Synchronizer::class);
6371
}
6472

6573
/**
@@ -95,13 +103,17 @@ private function sectionTimestampFlag(): bool
95103
{
96104
$forceNewSectionTimestampFlg = true;
97105

98-
if ((bool) $this->appConfig->getValue(Synchronizer::ALLOW_SYNC_WITH_BACKEND_PATH)) {
99-
$forceNewSectionTimestampFlg = false;
100-
$forceNewSectionTimestamp = $this->request->getParam('force_new_section_timestamp')
101-
?? $this->request->getParam('force_new_section_timestamp');
106+
if ((bool) $this->appConfig->getValue($this->synchronizer::ALLOW_SYNC_WITH_BACKEND_PATH)) {
107+
$sections = $this->request->getParam('sections');
108+
$sectionNames = explode(", ", $sections);
109+
if (!empty($sections) && in_array('cart', $sectionNames)) {
110+
$forceNewSectionTimestampFlg = false;
111+
$forceNewSectionTimestamp = $this->request->getParam('force_new_section_timestamp')
112+
?? $this->request->getParam('force_new_section_timestamp');
102113

103-
if ('true' === $forceNewSectionTimestamp) {
104-
$forceNewSectionTimestampFlg = true;
114+
if ('true' === $forceNewSectionTimestamp) {
115+
$forceNewSectionTimestampFlg = true;
116+
}
105117
}
106118
}
107119
return $forceNewSectionTimestampFlg;

0 commit comments

Comments
 (0)