amountIndexes = array('couponValue'); } /** * @param float|string $couponValue */ public function setCouponValue($couponValue) { $this->couponValue = $couponValue; } /** * @param string $couponCode */ public function setCouponCode($couponCode) { $this->couponCode = $couponCode; } public function getCouponValue() { return $this->couponValue; } public function getCouponCode() { return $this->couponCode; } public function isValid() { return isset($this->couponValue) or isset($this->couponCode); } public function applyToCart($rule, $cart) { $context = $cart->getContext()->getGlobalContext(); $couponCode = ! empty($this->couponCode) ? $this->couponCode : $context->getOption('default_discount_name'); $cart->addCoupon( new CouponCart( $context, CouponCart::TYPE_FIXED_VALUE, $couponCode, $this->couponValue, $rule->getId() ) ); } }