From b2a336c6a926e8cb3bf5e9038cbcf6a0ada70c01 Mon Sep 17 00:00:00 2001 From: Bastien Lamamy Date: Tue, 27 Nov 2018 13:58:02 +0100 Subject: [PATCH 1/4] getAttributeRawValue return 0 if value is 0 --- app/code/core/Mage/Catalog/Model/Resource/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php index 9d91684a12c..461add2f426 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php @@ -681,7 +681,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) $attributesData = $_data[1]; } - return $attributesData ? $attributesData : false; + return ($attributesData || $attributesData == '0') ? $attributesData : false; } /** From 9b158879661ce26d5a38cdeb403fd43412083721 Mon Sep 17 00:00:00 2001 From: Colin Mollenhour Date: Tue, 11 Dec 2018 12:21:49 -0500 Subject: [PATCH 2/4] Return first raw value if a single attribute was requested. --- app/code/core/Mage/Catalog/Model/Resource/Abstract.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php index 461add2f426..81adbed97b0 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php @@ -678,10 +678,10 @@ public function getAttributeRawValue($entityId, $attribute, $store) if (sizeof($attributesData) == 1) { $_data = each($attributesData); - $attributesData = $_data[1]; + return $_data[1]; } - return ($attributesData || $attributesData == '0') ? $attributesData : false; + return $attributesData ? $attributesData : false; } /** From 788af8525edc6f088a50bcc7092a3cef185098ff Mon Sep 17 00:00:00 2001 From: Ng Kiat Siong Date: Thu, 5 Jan 2023 13:16:17 +0800 Subject: [PATCH 3/4] Added null to return type. --- app/code/core/Mage/Catalog/Model/Resource/Abstract.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php index 5c8f5057627..6fbfe543b6e 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php @@ -699,7 +699,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) * @param int $entityId * @param int|string|array $attribute attribute's ids or codes * @param int|Mage_Core_Model_Store $store - * @return bool|string|array + * @return bool|string|null|array */ public function getAttributeRawText($entityId, $attribute, $store) { From 99737e69edc8ed6d7a4944a6ff11d0ff8e1d4ded Mon Sep 17 00:00:00 2001 From: Ng Kiat Siong Date: Thu, 5 Jan 2023 13:18:53 +0800 Subject: [PATCH 4/4] Added null to return type. To correct the last wrong commit. --- app/code/core/Mage/Catalog/Model/Resource/Abstract.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php index 6fbfe543b6e..ed4ff39f489 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Abstract.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Abstract.php @@ -575,7 +575,7 @@ protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_ * @param int $entityId * @param int|string|array $attribute atrribute's ids or codes * @param int|Mage_Core_Model_Store $store - * @return bool|string|array + * @return bool|string|null|array */ public function getAttributeRawValue($entityId, $attribute, $store) { @@ -699,7 +699,7 @@ public function getAttributeRawValue($entityId, $attribute, $store) * @param int $entityId * @param int|string|array $attribute attribute's ids or codes * @param int|Mage_Core_Model_Store $store - * @return bool|string|null|array + * @return bool|string|array */ public function getAttributeRawText($entityId, $attribute, $store) {