@@ -42,24 +42,32 @@ class Messages implements SectionSourceInterface
42
42
*/
43
43
private $ appConfig ;
44
44
45
+ /**
46
+ * @var Synchronizer
47
+ */
48
+ private $ synchronizer ;
49
+
45
50
/**
46
51
* Constructor
47
52
*
48
53
* @param MessageManager $messageManager
49
54
* @param InterpretationStrategyInterface $interpretationStrategy
50
55
* @param RequestInterface $request
51
56
* @param Config $appConfig
57
+ * @param Synchronizer $synchronizer
52
58
*/
53
59
public function __construct (
54
60
MessageManager $ messageManager ,
55
61
InterpretationStrategyInterface $ interpretationStrategy ,
56
62
?RequestInterface $ request = null ,
57
- ?Config $ appConfig = null
63
+ ?Config $ appConfig = null ,
64
+ ?Synchronizer $ synchronizer = null
58
65
) {
59
66
$ this ->messageManager = $ messageManager ;
60
67
$ this ->interpretationStrategy = $ interpretationStrategy ;
61
68
$ this ->request = $ request ?: ObjectManager::getInstance ()->get (RequestInterface::class);
62
69
$ this ->appConfig = $ appConfig ?: ObjectManager::getInstance ()->get (Config::class);
70
+ $ this ->synchronizer = $ synchronizer ?: ObjectManager::getInstance ()->get (Synchronizer::class);
63
71
}
64
72
65
73
/**
@@ -95,13 +103,17 @@ private function sectionTimestampFlag(): bool
95
103
{
96
104
$ forceNewSectionTimestampFlg = true ;
97
105
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 ' );
102
113
103
- if ('true ' === $ forceNewSectionTimestamp ) {
104
- $ forceNewSectionTimestampFlg = true ;
114
+ if ('true ' === $ forceNewSectionTimestamp ) {
115
+ $ forceNewSectionTimestampFlg = true ;
116
+ }
105
117
}
106
118
}
107
119
return $ forceNewSectionTimestampFlg ;
0 commit comments