protected function validateCouponCheckout()
    {
        $price_rule_id = $this->getPosted('check_pricerule', null, true, 'integer');

        if (empty($price_rule_id)) {
            return null;
        }

        $code = $this->getSubmitted('data.pricerule_code', '');

        if ($code === '') {
            return null;
        }

        if (!$this->order->priceRuleCodeMatches($price_rule_id, $code)) {
            $this->setError('pricerule_code', $this->text('Invalid code'));
            $this->setMessageFormCheckout('components.danger', $this->text('Invalid code'));
        }
    }
protected function validateCouponCheckout()
    {
        $price_rule_id = $this->getPosted('check_pricerule', null, true, 'integer');

        if (empty($price_rule_id)) {
            return null;
        }

        $code = $this->getSubmitted('data.pricerule_code', '');

        if ($code === '') {
            return null;
        }

        if (!$this->order->priceRuleCodeMatches($price_rule_id, $code)) {
            $this->setError('pricerule_code', $this->text('Invalid code'));
            $this->setMessageFormCheckout('components.danger', $this->text('Invalid code'));
        }
    }
protected function validateCouponCheckout ( ) { $ price_rule_id = $ this -> getPosted ( 'check_pricerule' , null , true , 'integer' ) ; if ( empty ( $ price_rule_id ) ) { return null ; } $ code = $ this -> getSubmitted ( 'data.pricerule_code' , '' ) ; if ( $ code === '' ) { return null ; } if ( ! $ this -> order -> priceRuleCodeMatches ( $ price_rule_id , $ code ) ) { $ this -> setError ( 'pricerule_code' , $ this -> text ( 'Invalid code' ) ) ; $ this -> setMessageFormCheckout ( 'components.danger' , $ this -> text ( 'Invalid code' ) ) ; } }
Validates a coupon code
Validates a coupon code