public function validateCode($code)
    {
        $coupon = $this->_controller->getRepository()->find(array('code' => $code));

        if ($coupon && !$coupon->expired()) {
            $discount = $coupon->discount * 100;
            $this->setMessage(AnTranslator::sprintf('COM-SUBSCRIPTIONS-VALID-COUPON', $discount));
            return true;
        } else {
            $this->setMessage(AnTranslator::_('COM-SUBSCRIPTIONS-INVALID-COUPON'));
            return false;
        }
    }
public function validateCode($code)
    {
        $coupon = $this->_controller->getRepository()->find(array('code' => $code));

        if ($coupon && !$coupon->expired()) {
            $discount = $coupon->discount * 100;
            $this->setMessage(AnTranslator::sprintf('COM-SUBSCRIPTIONS-VALID-COUPON', $discount));
            return true;
        } else {
            $this->setMessage(AnTranslator::_('COM-SUBSCRIPTIONS-INVALID-COUPON'));
            return false;
        }
    }
public function validateCode ( $ code ) { $ coupon = $ this -> _controller -> getRepository ( ) -> find ( array ( 'code' => $ code ) ) ; if ( $ coupon && ! $ coupon -> expired ( ) ) { $ discount = $ coupon -> discount * 100 ; $ this -> setMessage ( AnTranslator :: sprintf ( 'COM-SUBSCRIPTIONS-VALID-COUPON' , $ discount ) ) ; return true ; } else { $ this -> setMessage ( AnTranslator :: _ ( 'COM-SUBSCRIPTIONS-INVALID-COUPON' ) ) ; return false ; } }
Validates a coupon code.

@param string $code The coupon code to validate

@return bool
Validates a coupon code .