don't save the currentCoupons in a property. Retrieve them from the
session
This commit is contained in:
@@ -43,9 +43,6 @@ class CouponManager
|
||||
/** @var ContainerInterface Service Container */
|
||||
protected $container = null;
|
||||
|
||||
/** @var array CouponInterface to process*/
|
||||
protected $coupons = array();
|
||||
|
||||
/** @var array Available Coupons (Services) */
|
||||
protected $availableCoupons = array();
|
||||
|
||||
@@ -61,7 +58,6 @@ class CouponManager
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->facade = $container->get('thelia.facade');
|
||||
$this->coupons = $this->facade->getCurrentCoupons();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,9 +70,9 @@ class CouponManager
|
||||
public function getDiscount()
|
||||
{
|
||||
$discount = 0.00;
|
||||
|
||||
if (count($this->coupons) > 0) {
|
||||
$couponsKept = $this->sortCoupons($this->coupons);
|
||||
$coupons = $this->facade->getCurrentCoupons();
|
||||
if (count($coupons) > 0) {
|
||||
$couponsKept = $this->sortCoupons($coupons);
|
||||
|
||||
$discount = $this->getEffect($couponsKept);
|
||||
|
||||
@@ -96,11 +92,12 @@ class CouponManager
|
||||
*/
|
||||
public function isCouponRemovingPostage()
|
||||
{
|
||||
if (count($this->coupons) == 0) {
|
||||
$coupons = $this->facade->getCurrentCoupons();
|
||||
if (count($coupons) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$couponsKept = $this->sortCoupons($this->coupons);
|
||||
$couponsKept = $this->sortCoupons($coupons);
|
||||
|
||||
/** @var CouponInterface $coupon */
|
||||
foreach ($couponsKept as $coupon) {
|
||||
|
||||
Reference in New Issue
Block a user