public function getCurrentCoupons()
    {
        $couponCodes = $this->getRequest()->getSession()->getConsumedCoupons();

        if (null === $couponCodes) {
            return array();
        }
        /** @var CouponFactory $couponFactory */
        $couponFactory = $this->container->get('thelia.coupon.factory');

        $coupons = [];

        foreach ($couponCodes as $couponCode) {
            // Only valid coupons are returned
            try {
                if (false !== $couponInterface = $couponFactory->buildCouponFromCode($couponCode)) {
                    $coupons[] = $couponInterface;
                }
            } catch (\Exception $ex) {
                // Just ignore the coupon and log the problem, just in case someone realize it.
                Tlog::getInstance()->warning(
                    sprintf("Coupon %s ignored, exception occurred: %s", $couponCode, $ex->getMessage())
                );
            }
        }

        return $coupons;
    }
public function getCurrentCoupons()
    {
        $couponCodes = $this->getRequest()->getSession()->getConsumedCoupons();

        if (null === $couponCodes) {
            return array();
        }
        /** @var CouponFactory $couponFactory */
        $couponFactory = $this->container->get('thelia.coupon.factory');

        $coupons = [];

        foreach ($couponCodes as $couponCode) {
            // Only valid coupons are returned
            try {
                if (false !== $couponInterface = $couponFactory->buildCouponFromCode($couponCode)) {
                    $coupons[] = $couponInterface;
                }
            } catch (\Exception $ex) {
                // Just ignore the coupon and log the problem, just in case someone realize it.
                Tlog::getInstance()->warning(
                    sprintf("Coupon %s ignored, exception occurred: %s", $couponCode, $ex->getMessage())
                );
            }
        }

        return $coupons;
    }
public function getCurrentCoupons ( ) { $ couponCodes = $ this -> getRequest ( ) -> getSession ( ) -> getConsumedCoupons ( ) ; if ( null === $ couponCodes ) { return array ( ) ; } /** @var CouponFactory $couponFactory */ $ couponFactory = $ this -> container -> get ( 'thelia.coupon.factory' ) ; $ coupons = [ ] ; foreach ( $ couponCodes as $ couponCode ) { // Only valid coupons are returned try { if ( false !== $ couponInterface = $ couponFactory -> buildCouponFromCode ( $ couponCode ) ) { $ coupons [ ] = $ couponInterface ; } } catch ( \ Exception $ ex ) { // Just ignore the coupon and log the problem, just in case someone realize it. Tlog :: getInstance ( ) -> warning ( sprintf ( "Coupon %s ignored, exception occurred: %s" , $ couponCode , $ ex -> getMessage ( ) ) ) ; } } return $ coupons ; }
Return all Coupon given during the Checkout

@return array Array of CouponInterface
Return all Coupon given during the Checkout