Do not allow to cumulate the coupon many times. Fix #217

This commit is contained in:
Manuel Raynaud
2014-02-19 16:41:22 +01:00
parent 41175e4a94
commit dafce9e070
6 changed files with 25 additions and 26 deletions

View File

@@ -76,17 +76,10 @@ class Cart extends BaseCart
public function getTaxedAmount(Country $country)
{
$taxCalculator = new Calculator();
$total = 0;
foreach($this->getCartItems() as $cartItem) {
$subtotal = $cartItem->getRealPrice();
/* we round it for the unit price, before the quantity factor */
$subtotal = round($taxCalculator->load($cartItem->getProduct(), $country)->getTaxedPrice($subtotal), 2);
$subtotal *= $cartItem->getQuantity();
$total += $subtotal;
$total += $cartItem->getRealTaxedPrice($country) * $cartItem->getQuantity();
}
$total -= $this->getDiscount();