@@ -16,13 +16,34 @@ public function __construct(
16
16
protected WebsiteRepositoryInterface $ websiteRepository
17
17
) {}
18
18
19
- public function isSettingAppliedForScopeAndCode (string $ path , string $ scope , string $ code ): bool
19
+ /**
20
+ * Is a scoped value different from the default?
21
+ * @param string $path
22
+ * @param string $scope
23
+ * @param mixed $code
24
+ * @return bool
25
+ */
26
+ public function isSettingAppliedForScopeAndCode (string $ path , string $ scope , mixed $ code ): bool
20
27
{
21
28
$ value = $ this ->scopeConfig ->getValue ($ path , $ scope , $ code );
22
29
$ defaultValue = $ this ->scopeConfig ->getValue ($ path );
23
30
return ($ value !== $ defaultValue );
24
31
}
25
32
33
+ /**
34
+ * Does a store config override the website config?
35
+ * @param string $path
36
+ * @param mixed $websiteId
37
+ * @param int $storeId
38
+ * @return bool
39
+ */
40
+ protected function isStoreSettingOverridingWebsite (string $ path , mixed $ websiteId , int $ storeId ): bool
41
+ {
42
+ $ storeValue = $ this ->scopeConfig ->getValue ($ path , ScopeInterface::SCOPE_STORES , $ storeId );
43
+ $ websiteValue = $ this ->scopeConfig ->getValue ($ path , ScopeInterface::SCOPE_WEBSITES , $ websiteId );
44
+ return ($ storeValue !== $ websiteValue );
45
+ }
46
+
26
47
/**
27
48
* For a given path, check if that path has a non-default value
28
49
* and if so perform corresponding logic (specified via callback)
@@ -94,9 +115,9 @@ public function getAffectedStoreIds(string $path, string $scope, int $scopeId):
94
115
case ScopeInterface::SCOPE_WEBSITES :
95
116
$ website = $ this ->websiteRepository ->getById ($ scopeId );
96
117
foreach ($ website ->getStores () as $ store ) {
97
- if (!$ this ->isSettingAppliedForScopeAndCode (
118
+ if (!$ this ->isStoreSettingOverridingWebsite (
98
119
$ path ,
99
- ScopeInterface:: SCOPE_STORES ,
120
+ $ website -> getId () ,
100
121
$ store ->getId ()
101
122
)) {
102
123
$ storeIds [] = $ store ->getId ();
0 commit comments