Skip to content

Commit

Permalink
Update Source.php
Browse files Browse the repository at this point in the history
Fixed `Zend_Db_Expr` Evozon-PHP#8
  • Loading branch information
henryhayes authored Jun 4, 2023
1 parent dd37965 commit a087256
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,19 @@ public function getAttributesValue()
$select->where('e.entity_id IN (?)', $postIds);
}

if (stristr($attrCode, 'date')) {
$expr = new Zend_Db_Expr("IF (joins.{$attrCode} IS NULL, joins.{$attrCode}_default, joins.{$attrCode} ) AS {$attrCode}");
} else {
$expr = new Zend_Db_Expr("IF (joins.{$attrCode} IS NULL OR joins.{$attrCode} = '', joins.{$attrCode}_default, joins.{$attrCode} ) AS {$attrCode}");
}

$selectSql = $adapter->select()
->from(
array('joins' => $select),
array(
'entity_id' => 'joins.entity_id',
'store_id' => "joins.{$attrCode}_store",
new Zend_Db_Expr("IF (joins.{$attrCode} IS NULL OR joins.{$attrCode} = '', joins.{$attrCode}_default, joins.{$attrCode} ) AS {$attrCode}")
$expr
)
);

Expand Down Expand Up @@ -177,4 +183,4 @@ public function getStoreIds()
{
return $this->_storeIds;
}
}
}

0 comments on commit a087256

Please sign in to comment.