@@ -146,7 +146,7 @@ public function execute($entityType, $entityData, $arguments = [])
146
146
$ attributeTables [$ attribute ->getBackend ()->getTable ()][] = $ attribute ->getAttributeId ();
147
147
$ attributesMap [$ attribute ->getAttributeId ()] = $ attribute ->getAttributeCode ();
148
148
$ attributeScopeGlobal [$ attribute ->getAttributeId ()] =
149
- $ attribute ->getIsGlobal () === ScopedAttributeInterface::SCOPE_GLOBAL ;
149
+ $ attribute ->getIsGlobal () === ScopedAttributeInterface::SCOPE_GLOBAL ? 1 : 0 ;
150
150
}
151
151
}
152
152
if (count ($ attributeTables )) {
@@ -180,13 +180,23 @@ public function execute($entityType, $entityData, $arguments = [])
180
180
$ attributes = $ connection ->fetchAll ($ orderedUnionSelect );
181
181
foreach ($ attributes as $ attributeValue ) {
182
182
if (isset ($ attributesMap [$ attributeValue ['attribute_id ' ]])) {
183
- if ($ attributeScopeGlobal [$ attributeValue ['attribute_id ' ]] &&
184
- (int )$ attributeValue ['store_id ' ] !== Store::DEFAULT_STORE_ID
185
- ) {
183
+ $ isGlobalAttribute = $ attributeScopeGlobal [$ attributeValue ['attribute_id ' ]];
184
+ $ storeId = $ attributeValue ['store_id ' ] ?? null ;
185
+
186
+ // Set global value if attribute scope is set to Global
187
+ if ($ isGlobalAttribute && (int )$ storeId === Store::DEFAULT_STORE_ID ) {
188
+ $ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
189
+ continue ;
190
+ }
191
+
192
+ if (!$ isGlobalAttribute && (int )$ storeId === Store::DEFAULT_STORE_ID ) {
186
193
$ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
187
194
continue ;
188
195
}
189
- $ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
196
+
197
+ if (!$ isGlobalAttribute && (int )$ storeId !== Store::DEFAULT_STORE_ID ) {
198
+ $ entityData [$ attributesMap [$ attributeValue ['attribute_id ' ]]] = $ attributeValue ['value ' ];
199
+ }
190
200
} else {
191
201
$ this ->logger ->warning (
192
202
"Attempt to load value of nonexistent EAV attribute " ,
0 commit comments