Skip to content

Commit 0837571

Browse files
authored
Removed unnecessary joins for global attributes (#1309)
1 parent 8932fec commit 0837571

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/code/core/Mage/Catalog/Model/Resource/Abstract.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
601601
$typedAttributes = array();
602602
$staticTable = null;
603603
$adapter = $this->_getReadAdapter();
604+
$getPerStore = false;
604605

605606
foreach ($attribute as $_attribute) {
606607
/* @var Mage_Catalog_Model_Entity_Attribute $attribute */
@@ -612,6 +613,10 @@ public function getAttributeRawValue($entityId, $attribute, $store)
612613
$attrTable = $_attribute->getBackend()->getTable();
613614
$isStatic = $_attribute->getBackend()->isStatic();
614615

616+
if (!$getPerStore && $_attribute->getIsGlobal() != Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL) {
617+
$getPerStore = true;
618+
}
619+
615620
if ($isStatic) {
616621
$staticAttributes[] = $attributeCode;
617622
$staticTable = $attrTable;
@@ -654,7 +659,7 @@ public function getAttributeRawValue($entityId, $attribute, $store)
654659
'entity_id' => $entityId,
655660
);
656661

657-
if ($store != $this->getDefaultStoreId()) {
662+
if ($getPerStore && $store != $this->getDefaultStoreId()) {
658663
$valueExpr = $adapter->getCheckSql(
659664
'store_value.value IS NULL',
660665
'default_value.value',

0 commit comments

Comments
 (0)