coupons effect are recalculated after each product's cart modification. Fix #237
This commit is contained in:
@@ -161,6 +161,22 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
$event->setDiscount($totalDiscount);
|
||||
}
|
||||
|
||||
public function updateOrderDiscount($event)
|
||||
{
|
||||
|
||||
$discount = $this->couponManager->getDiscount();
|
||||
|
||||
$this->request
|
||||
->getSession()
|
||||
->getCart()
|
||||
->setDiscount($discount)
|
||||
->save();
|
||||
$this->request
|
||||
->getSession()
|
||||
->getOrder()
|
||||
->setDiscount($discount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call the Model and delegate the create or delete action
|
||||
* Feed the Event with the updated model
|
||||
@@ -310,6 +326,9 @@ class Coupon extends BaseAction implements EventSubscriberInterface
|
||||
TheliaEvents::COUPON_CONDITION_UPDATE => array("updateCondition", 128),
|
||||
TheliaEvents::ORDER_SET_POSTAGE => array("testFreePostage", 256),
|
||||
TheliaEvents::ORDER_BEFORE_PAYMENT => array("afterOrder", 128),
|
||||
TheliaEvents::CART_ADDITEM => array("updateOrderDiscount", 10),
|
||||
TheliaEvents::CART_UPDATEITEM => array("updateOrderDiscount", 10),
|
||||
TheliaEvents::CART_DELETEITEM => array("updateOrderDiscount", 10),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user