protected function validateSkuCart()
    {
        if ($this->isError('store_id')) {
            return null;
        }

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

        if (!isset($value)) {
            return null;
        }

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

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $store_id = $this->getSubmitted('store_id');
        $product = $this->product->getBySku($value, $store_id);

        if (empty($product['product_id'])) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        $this->setSubmitted('product', $product);
        return true;
    }
protected function validateSkuCart()
    {
        if ($this->isError('store_id')) {
            return null;
        }

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

        if (!isset($value)) {
            return null;
        }

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

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $store_id = $this->getSubmitted('store_id');
        $product = $this->product->getBySku($value, $store_id);

        if (empty($product['product_id'])) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        $this->setSubmitted('product', $product);
        return true;
    }
protected function validateSkuCart ( ) { if ( $ this -> isError ( 'store_id' ) ) { return null ; } $ field = 'sku' ; $ value = $ this -> getSubmitted ( $ field ) ; if ( ! isset ( $ value ) ) { return null ; } $ label = $ this -> translation -> text ( 'SKU' ) ; if ( empty ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } $ store_id = $ this -> getSubmitted ( 'store_id' ) ; $ product = $ this -> product -> getBySku ( $ value , $ store_id ) ; if ( empty ( $ product [ 'product_id' ] ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } $ this -> setSubmitted ( 'product' , $ product ) ; return true ; }
Validates a cart item SKU
@return boolean|null
Validates a cart item SKU