protected function validateComponentPricesOrder()
    {
        $field = 'data.components';
        $components = $this->getSubmitted($field);

        if (empty($components)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Price');

        if (!is_array($components)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        foreach ($components as $id => $component) {

            if (!is_numeric($component['price'])) {
                $this->setErrorNumeric("$field.$id", $label);
                continue;
            }

            if (strlen($component['price']) > 10) {
                $this->setErrorLengthRange("$field.$id", $label, 0, 10);
            }
        }

        return !$this->isError('components');
    }
protected function validateComponentPricesOrder()
    {
        $field = 'data.components';
        $components = $this->getSubmitted($field);

        if (empty($components)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Price');

        if (!is_array($components)) {
            $this->setErrorInvalid($field, $label);
            return false;
        }

        foreach ($components as $id => $component) {

            if (!is_numeric($component['price'])) {
                $this->setErrorNumeric("$field.$id", $label);
                continue;
            }

            if (strlen($component['price']) > 10) {
                $this->setErrorLengthRange("$field.$id", $label, 0, 10);
            }
        }

        return !$this->isError('components');
    }
protected function validateComponentPricesOrder ( ) { $ field = 'data.components' ; $ components = $ this -> getSubmitted ( $ field ) ; if ( empty ( $ components ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Price' ) ; if ( ! is_array ( $ components ) ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } foreach ( $ components as $ id => $ component ) { if ( ! is_numeric ( $ component [ 'price' ] ) ) { $ this -> setErrorNumeric ( "$field.$id" , $ label ) ; continue ; } if ( strlen ( $ component [ 'price' ] ) > 10 ) { $ this -> setErrorLengthRange ( "$field.$id" , $ label , 0 , 10 ) ; } } return ! $ this -> isError ( 'components' ) ; }
Validates order component prices
@return bool
Validates order component prices