Skip to content

Commit

Permalink
fix #1192 (#1198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Digital Pianism authored Sep 19, 2022
1 parent f96f0b3 commit c4c2102
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion app/code/core/Mage/Eav/Model/Entity/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,12 @@ protected function _loadModelAttributes($object)
$selectGroups = $helper->getLoadAttributesSelectGroups($selects);
foreach ($selectGroups as $selects) {
if (!empty($selects)) {
$select = $this->_prepareLoadSelect($selects);
if (is_array($selects)) {
$select = $this->_prepareLoadSelect($selects);
} else {
$select = $selects;
}

$values = $this->_getReadAdapter()->fetchAll($select);
foreach ($values as $valueRow) {
$this->_setAttributeValue($object, $valueRow);
Expand Down
7 changes: 6 additions & 1 deletion app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,12 @@ public function _loadAttributes($printQuery = false, $logQuery = false)
foreach ($selectGroups as $selects) {
if (!empty($selects)) {
try {
$select = implode(' UNION ALL ', $selects);
if (is_array($selects)) {
$select = implode(' UNION ALL ', $selects);
} else {
$select = $selects;
}

$values = $this->getConnection()->fetchAll($select);
} catch (Exception $e) {
Mage::printException($e, $select);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getLoadAttributesSelectGroups($selects)
foreach ($selects as $eavType => $selectGroup) {
$mainGroup = array_merge($mainGroup, $selectGroup);
}
return [$mainGroup];
return $mainGroup;
}

/**
Expand Down

0 comments on commit c4c2102

Please sign in to comment.