From 245999cc9cb6752b13327732481b59a624fcc656 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Sat, 3 Sep 2022 09:19:31 +0100 Subject: [PATCH] Fixed broken grids caused by PR #2545 --- app/code/core/Mage/Eav/Model/Config.php | 29 +++++++++++-------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/app/code/core/Mage/Eav/Model/Config.php b/app/code/core/Mage/Eav/Model/Config.php index f79bb22e93e..daa979cb4a3 100644 --- a/app/code/core/Mage/Eav/Model/Config.php +++ b/app/code/core/Mage/Eav/Model/Config.php @@ -353,12 +353,11 @@ protected function _initAttributes($entityType) /** @var Mage_Eav_Model_Resource_Entity_Attribute_Collection $attributesInfo */ $attributesInfo = Mage::getResourceModel($entityType->getEntityAttributeCollection()); - $attributesInfo - ->setEntityTypeFilter($entityType) - ->getData(); + $attributesInfo->setEntityTypeFilter($entityType); + $attributesInfoData = $attributesInfo->getData(); $codes = []; - foreach ($attributesInfo as $attribute) { + foreach ($attributesInfoData as $attribute) { $this->_createAttribute($entityType, $attribute); $codes[] = $attribute['attribute_code']; } @@ -472,10 +471,10 @@ public function getEntityAttributeCodes($entityType, $object = null) $attributesInfo ->setEntityTypeFilter($entityType) ->setAttributeSetFilter($attributeSetId) - ->addStoreLabel($storeId) - ->getData(); + ->addStoreLabel($storeId); + $attributesInfoData = $attributesInfo->getData(); $attributes = []; - foreach ($attributesInfo as $attributeData) { + foreach ($attributesInfoData as $attributeData) { $attributes[] = $attributeData['attribute_code']; $this->_createAttribute($entityType, $attributeData); } @@ -524,17 +523,17 @@ public function preloadAttributes($entityType, $attributes) $attributesInfo = Mage::getResourceModel($entityType->getEntityAttributeCollection()); $attributesInfo ->setEntityTypeFilter($entityType) - ->setCodeFilter($attributes) - ->getData(); + ->setCodeFilter($attributes); + $attributesInfoData = $attributesInfo->getData(); - if (!$attributesInfo) { + if (!$attributesInfoData) { Varien_Profiler::stop('EAV: '.__METHOD__ . ':'.$entityTypeCode); return $this; } $attributesData = $codes = []; - foreach ($attributesInfo as $attribute) { + foreach ($attributesInfoData as $attribute) { if (empty($attribute['attribute_model'])) { $attribute['attribute_model'] = $entityType->getAttributeModel(); } @@ -548,9 +547,7 @@ public function preloadAttributes($entityType, $attributes) } $this->_attributeData[$entityTypeCode] = $attributesData; - Varien_Profiler::stop('EAV: '.__METHOD__ . ':'.$entityTypeCode); - return $this; } @@ -619,10 +616,10 @@ public function loadCollectionAttributes($entityType, $attributes) $attributesInfo ->useLoadDataFields() ->setEntityTypeFilter($entityType) - ->setCodeFilter($attributes) - ->getData(); + ->setCodeFilter($attributes); + $attributesInfoData = $attributesInfo->getData(); - foreach ($attributesInfo as $attributeData) { + foreach ($attributesInfoData as $attributeData) { $attribute = $this->_createAttribute($entityType, $attributeData); $this->_collectionAttributes[$entityTypeCode][$attribute->getAttributeCode()] =$attribute; }