@@ -158,6 +158,18 @@ protected function _getLoadAttributesSelect($table, $attributeIds = [])
158
158
$ entityIdField = $ indexList [$ connection ->getPrimaryKeyName ($ entityTable )]['COLUMNS_LIST ' ][0 ];
159
159
160
160
if ($ storeId ) {
161
+
162
+ foreach ($ attributeIds as $ id ) {
163
+ $ attribute = $ this ->_eavConfig ->getAttribute (
164
+ $ this ->getEntity ()->getType (),
165
+ $ id
166
+ );
167
+
168
+ if ($ attribute ->getAttributeCode () === 'price ' && (int )$ attribute ->getIsGlobal () === 1 ) {
169
+ $ storeId = $ this ->getDefaultStoreId ();
170
+ }
171
+ }
172
+
161
173
$ joinCondition = [
162
174
't_s.attribute_id = t_d.attribute_id ' ,
163
175
"t_s. {$ entityIdField } = t_d. {$ entityIdField }" ,
@@ -230,67 +242,6 @@ protected function _addLoadAttributesSelectValues($select, $table, $type)
230
242
return $ select ;
231
243
}
232
244
233
- /**
234
- * Initialize entity object property value
235
- *
236
- * Update attribute value if attribute scope is global
237
- *
238
- * Parameter $valueInfo is _getLoadAttributesSelect fetch result row
239
- *
240
- * @param array $valueInfo
241
- * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection
242
- * @throws LocalizedException
243
- */
244
- protected function _setItemAttributeValue ($ valueInfo )
245
- {
246
- $ entityIdField = $ this ->getEntity ()->getEntityIdField ();
247
- $ entityId = $ valueInfo [$ entityIdField ];
248
- if (!isset ($ this ->_itemsById [$ entityId ])) {
249
- throw new LocalizedException (
250
- __ ('A header row is missing for an attribute. Verify the header row and try again. ' )
251
- );
252
- }
253
-
254
- $ attribute = $ this ->_eavConfig ->getAttribute (
255
- $ this ->getEntity ()->getType (),
256
- $ valueInfo ['attribute_id ' ]
257
- );
258
- if ((int )$ attribute ->getIsGlobal () === ScopedAttributeInterface::SCOPE_GLOBAL ) {
259
- $ select = $ this ->getConnection ()->select ()
260
- ->from (
261
- ['e ' => $ this ->getEntity ()->getEntityTable ()],
262
- ['entity_id ' ]
263
- )
264
- ->join (
265
- ['t_d ' => $ attribute ->getBackend ()->getTable ()],
266
- "e. {$ this ->getEntity ()->getLinkField ()} = t_d. {$ attribute ->getEntity ()->getLinkField ()}" ,
267
- ['t_d.value ' ]
268
- )->where (
269
- " e.entity_id = ? " ,
270
- $ entityId ,
271
- \Zend_Db::INT_TYPE
272
- )->where (
273
- 't_d.attribute_id = ? ' ,
274
- $ attribute ->getAttributeId (),
275
- \Zend_Db::INT_TYPE
276
- )->where (
277
- 't_d.store_id = ? ' ,
278
- $ this ->getDefaultStoreId (),
279
- \Zend_Db::INT_TYPE
280
- );
281
- $ data = $ this ->getConnection ()->fetchRow ($ select );
282
- if ($ data && is_array ($ data )) {
283
- $ valueInfo ['value ' ] = $ data ['value ' ];
284
- }
285
- }
286
-
287
- foreach ($ this ->_itemsById [$ entityId ] as $ object ) {
288
- $ object ->setData ($ attribute ->getAttributeCode (), $ valueInfo ['value ' ]);
289
- }
290
-
291
- return $ this ;
292
- }
293
-
294
245
/**
295
246
* Adding join statement to collection select instance
296
247
*
0 commit comments