protected function validateValuePriceRule()
    {
        $field = 'value';

        if ($this->isExcluded($field) || $this->isError('value_type')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        if (!isset($value)) {
            $this->setErrorRequired($field, $this->translation->text('Value'));
            return false;
        }

        $updating = $this->getUpdating();
        $submitted_value_type = $this->getSubmitted('value_type');

        if (isset($submitted_value_type)) {
            $value_type = $submitted_value_type;
        } else if (isset($updating['value_type'])) {
            $value_type = $updating['value_type'];
        } else {
            $this->setErrorUnavailable('value_type', $this->translation->text('Value type'));
            return false;
        }

        try {
            $handlers = $this->price_rule->getTypes();
            return static::call($handlers, $value_type, 'validate', array($value, $this));
        } catch (Exception $ex) {
            $this->setError($field, $ex->getMessage());
            return false;
        }
    }
protected function validateValuePriceRule()
    {
        $field = 'value';

        if ($this->isExcluded($field) || $this->isError('value_type')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        if (!isset($value)) {
            $this->setErrorRequired($field, $this->translation->text('Value'));
            return false;
        }

        $updating = $this->getUpdating();
        $submitted_value_type = $this->getSubmitted('value_type');

        if (isset($submitted_value_type)) {
            $value_type = $submitted_value_type;
        } else if (isset($updating['value_type'])) {
            $value_type = $updating['value_type'];
        } else {
            $this->setErrorUnavailable('value_type', $this->translation->text('Value type'));
            return false;
        }

        try {
            $handlers = $this->price_rule->getTypes();
            return static::call($handlers, $value_type, 'validate', array($value, $this));
        } catch (Exception $ex) {
            $this->setError($field, $ex->getMessage());
            return false;
        }
    }
protected function validateValuePriceRule ( ) { $ field = 'value' ; if ( $ this -> isExcluded ( $ field ) || $ this -> isError ( 'value_type' ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } if ( ! isset ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ this -> translation -> text ( 'Value' ) ) ; return false ; } $ updating = $ this -> getUpdating ( ) ; $ submitted_value_type = $ this -> getSubmitted ( 'value_type' ) ; if ( isset ( $ submitted_value_type ) ) { $ value_type = $ submitted_value_type ; } else if ( isset ( $ updating [ 'value_type' ] ) ) { $ value_type = $ updating [ 'value_type' ] ; } else { $ this -> setErrorUnavailable ( 'value_type' , $ this -> translation -> text ( 'Value type' ) ) ; return false ; } try { $ handlers = $ this -> price_rule -> getTypes ( ) ; return static :: call ( $ handlers , $ value_type , 'validate' , array ( $ value , $ this ) ) ; } catch ( Exception $ ex ) { $ this -> setError ( $ field , $ ex -> getMessage ( ) ) ; return false ; } }
Validates a price rule value
@return boolean|null
Validates a price rule value