Black Belt
- Join Date:
- Jul 2005
- Location:
- Upstate NY
- Posts:
- 21,874
- Plugin Contributions:
- 8
Potential zen_has_product_attributes_values() error
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
/*
-
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;
}
}
"select sum(options_values_price)
"select sum((abs)options_values_price) or whatever is correct syntax for mysql.