From c4c2102eebabbee21a53132666e57b2352ae0e5c Mon Sep 17 00:00:00 2001 From: Digital Pianism Date: Tue, 20 Sep 2022 00:09:16 +0200 Subject: [PATCH] fix #1192 (#1198) --- app/code/core/Mage/Eav/Model/Entity/Abstract.php | 7 ++++++- .../core/Mage/Eav/Model/Entity/Collection/Abstract.php | 7 ++++++- app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/code/core/Mage/Eav/Model/Entity/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Abstract.php index 7b7b76e4479..5a35eebdab7 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Abstract.php @@ -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); diff --git a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php index 4c361808ac1..bcd055b7d4f 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php +++ b/app/code/core/Mage/Eav/Model/Entity/Collection/Abstract.php @@ -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); diff --git a/app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php index 3321bd11925..2dc4eaf2533 100644 --- a/app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/Eav/Model/Resource/Helper/Mysql4.php @@ -108,7 +108,7 @@ public function getLoadAttributesSelectGroups($selects) foreach ($selects as $eavType => $selectGroup) { $mainGroup = array_merge($mainGroup, $selectGroup); } - return [$mainGroup]; + return $mainGroup; } /**