diff --git a/core/lib/Thelia/Action/Coupon.php b/core/lib/Thelia/Action/Coupon.php index d9bbf4eb6..adf589578 100644 --- a/core/lib/Thelia/Action/Coupon.php +++ b/core/lib/Thelia/Action/Coupon.php @@ -136,24 +136,26 @@ class Coupon extends BaseAction implements EventSubscriberInterface $consumedCoupons = array(); } - // Prevent accumulation of the same Coupon on a Checkout - $consumedCoupons[$event->getCode()] = $event->getCode(); + if (!isset($consumedCoupons[$event->getCode()])) { + // Prevent accumulation of the same Coupon on a Checkout + $consumedCoupons[$event->getCode()] = $event->getCode(); - $this->request->getSession()->setConsumedCoupons($consumedCoupons); + $this->request->getSession()->setConsumedCoupons($consumedCoupons); - $totalDiscount = $this->couponManager->getDiscount(); + $totalDiscount = $this->couponManager->getDiscount(); - $this->request - ->getSession() - ->getCart() - ->setDiscount($totalDiscount) - ->save(); - $this->request - ->getSession() - ->getOrder() - ->setDiscount($totalDiscount) - // ->save() - ; + $this->request + ->getSession() + ->getCart() + ->setDiscount($totalDiscount) + ->save(); + $this->request + ->getSession() + ->getOrder() + ->setDiscount($totalDiscount) + // ->save() + ; + } } } diff --git a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php index 32bc152f7..01ee7f0eb 100644 --- a/core/lib/Thelia/Coupon/Type/RemoveXPercent.php +++ b/core/lib/Thelia/Coupon/Type/RemoveXPercent.php @@ -103,8 +103,8 @@ class RemoveXPercent extends CouponAbstract 'Percentage must be inferior to 100' ); } - - $basePrice = $this->facade->getCartTotalPrice(); + $taxCountry = $this->facade->getContainer()->get('thelia.taxEngine')->getDeliveryCountry(); + $basePrice = $this->facade->getCart()->getTaxedAmount($taxCountry); return round($basePrice * $this->percentage/100, 2); } diff --git a/core/lib/Thelia/Model/Cart.php b/core/lib/Thelia/Model/Cart.php index 0c30f2acf..507b1c2e2 100644 --- a/core/lib/Thelia/Model/Cart.php +++ b/core/lib/Thelia/Model/Cart.php @@ -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(); diff --git a/core/lib/Thelia/Model/CartItem.php b/core/lib/Thelia/Model/CartItem.php index 4e533f79d..1fe266aee 100644 --- a/core/lib/Thelia/Model/CartItem.php +++ b/core/lib/Thelia/Model/CartItem.php @@ -94,6 +94,11 @@ class CartItem extends BaseCartItem return $this->getPromo() == 1 ? $this->getPromoPrice() : $this->getPrice(); } + public function getRealTaxedPrice(Country $country) + { + return $this->getPromo() == 1 ? $this->getTaxedPromoPrice($country) : $this->getTaxedPrice($country); + } + public function getTaxedPrice(Country $country) { $taxCalculator = new Calculator(); diff --git a/local/modules/Colissimo/Config/thelia.sql b/local/modules/Colissimo/Config/thelia.sql old mode 100644 new mode 100755 diff --git a/templates/frontOffice/default/order-invoice.html b/templates/frontOffice/default/order-invoice.html index e1fb29b01..eebaa921b 100644 --- a/templates/frontOffice/default/order-invoice.html +++ b/templates/frontOffice/default/order-invoice.html @@ -266,7 +266,6 @@ {loop type="payment" name="payments" force_return="true"} {assign "paymentModuleId" $ID} - {loop type="image" name="paymentspicture" source="module" source_id=$ID force_return="true" width="100" height="72"}