[-] FO : potential divide by zero removed #PSCFV-2787

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15970 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dMetzger
2012-06-11 14:36:16 +00:00
parent 4584db99fe
commit 168bda9273
+6 -2
View File
@@ -799,8 +799,12 @@ class CartRuleCore extends ObjectModel
if ($this->reduction_amount)
{
$prorata = 1;
if (!is_null($package))
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package['products']) / $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS);
if (!is_null($package) && count($all_products))
{
$total_products = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS);
if ($total_products)
$prorata = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package['products']) / $total_products;
}
$reduction_amount = $this->reduction_amount;
// If we need to convert the voucher value to the cart currency