Skip to content

Commit

Permalink
Fixed broken grids caused by PR #2545 (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano authored Sep 3, 2022
1 parent 2d79049 commit 028f783
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions app/code/core/Mage/Eav/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
}
Expand All @@ -548,9 +547,7 @@ public function preloadAttributes($entityType, $attributes)
}

$this->_attributeData[$entityTypeCode] = $attributesData;

Varien_Profiler::stop('EAV: '.__METHOD__ . ':'.$entityTypeCode);

return $this;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 028f783

Please sign in to comment.