I noticed that in /includes/functions/functions_lookups.php, this function could apparently return a false negative if there were two or more attributes with equal and opposite total values (e.g. one adds $5.00 to base price and the other subtracts $5.00 from base).
PHP Code:
/*
* Check if product has attributes values
*/
function zen_has_product_attributes_values($products_id) {
global $db;
$attributes_query = "select sum(options_values_price) as total
from " . TABLE_PRODUCTS_ATTRIBUTES . "
where products_id = '" . (int)$products_id . "'";
$attributes = $db->Execute($attributes_query);
if ($attributes->fields['total'] != 0) {
return true;
} else {
return false;
}
}
It would appear that taking the absolute values of the prices before summing them would correct this.
"select sum(options_values_price)
"select sum((abs)options_values_price) or whatever is correct syntax for mysql.
Bookmarks