// Fix group reduction per category

This commit is contained in:
Rémi Gaillard
2013-10-04 14:00:42 +02:00
parent 6dacc07e62
commit fef8d2beac
2 changed files with 2 additions and 2 deletions
+1
View File
@@ -137,6 +137,7 @@ class GroupReductionCore extends ObjectModel
SELECT `reduction` SELECT `reduction`
FROM `'._DB_PREFIX_.'product_group_reduction_cache` FROM `'._DB_PREFIX_.'product_group_reduction_cache`
WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group); WHERE `id_product` = '.(int)$id_product.' AND `id_group` = '.(int)$id_group);
// Should return string (decimal in database) and not a float
return self::$reduction_cache[$id_product.'-'.$id_group]; return self::$reduction_cache[$id_product.'-'.$id_group];
} }
+1 -2
View File
@@ -2720,8 +2720,7 @@ class ProductCore extends ObjectModel
if ($use_group_reduction) if ($use_group_reduction)
{ {
$reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group); $reduction_from_category = GroupReduction::getValueForProduct($id_product, $id_group);
if ($reduction_from_category !== false)
if (!empty($reduction_from_category) && (float)$reduction_from_category == 0)
$price -= $price * (float)$reduction_from_category; $price -= $price * (float)$reduction_from_category;
else // apply group reduction if there is no group reduction for this category else // apply group reduction if there is no group reduction for this category
$price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100); $price *= ((100 - Group::getReductionByIdGroup($id_group)) / 100);