original_string: protected function validateOptionsCart()
      {
          $product = $this->getSubmitted('product');
  
          if (empty($product) || $this->isError()) {
              return null;
          }
  
          $options = array_filter((array) $this->getSubmitted('options'));
  
          if (empty($options)) {
              $this->setSubmitted('options', array());
              $this->setSubmitted('sku', $product['sku']);
              $this->setSubmitted('stock', $product['stock']);
              return true;
          }
  
          $combination_id = $this->sku->getCombinationId($options, $product['product_id']);
  
          if (empty($product['combination'][$combination_id]['status'])) {
              $error = $this->translation->text('Invalid combination');
              $this->setError('options', $error);
              return false;
          }
  
          $this->setSubmitted('options', $options);
          $this->setSubmitted('combination_id', $combination_id);
          $this->setSubmitted('sku', $product['combination'][$combination_id]['sku']);
          $this->setSubmitted('stock', $product['combination'][$combination_id]['stock']);
          return true;
      }
code: protected function validateOptionsCart()
      {
          $product = $this->getSubmitted('product');
  
          if (empty($product) || $this->isError()) {
              return null;
          }
  
          $options = array_filter((array) $this->getSubmitted('options'));
  
          if (empty($options)) {
              $this->setSubmitted('options', array());
              $this->setSubmitted('sku', $product['sku']);
              $this->setSubmitted('stock', $product['stock']);
              return true;
          }
  
          $combination_id = $this->sku->getCombinationId($options, $product['product_id']);
  
          if (empty($product['combination'][$combination_id]['status'])) {
              $error = $this->translation->text('Invalid combination');
              $this->setError('options', $error);
              return false;
          }
  
          $this->setSubmitted('options', $options);
          $this->setSubmitted('combination_id', $combination_id);
          $this->setSubmitted('sku', $product['combination'][$combination_id]['sku']);
          $this->setSubmitted('stock', $product['combination'][$combination_id]['stock']);
          return true;
      }
code_tokens: protected function validateOptionsCart ( ) { $ product = $ this -> getSubmitted ( 'product' ) ; if ( empty ( $ product ) || $ this -> isError ( ) ) { return null ; } $ options = array_filter ( ( array ) $ this -> getSubmitted ( 'options' ) ) ; if ( empty ( $ options ) ) { $ this -> setSubmitted ( 'options' , array ( ) ) ; $ this -> setSubmitted ( 'sku' , $ product [ 'sku' ] ) ; $ this -> setSubmitted ( 'stock' , $ product [ 'stock' ] ) ; return true ; } $ combination_id = $ this -> sku -> getCombinationId ( $ options , $ product [ 'product_id' ] ) ; if ( empty ( $ product [ 'combination' ] [ $ combination_id ] [ 'status' ] ) ) { $ error = $ this -> translation -> text ( 'Invalid combination' ) ; $ this -> setError ( 'options' , $ error ) ; return false ; } $ this -> setSubmitted ( 'options' , $ options ) ; $ this -> setSubmitted ( 'combination_id' , $ combination_id ) ; $ this -> setSubmitted ( 'sku' , $ product [ 'combination' ] [ $ combination_id ] [ 'sku' ] ) ; $ this -> setSubmitted ( 'stock' , $ product [ 'combination' ] [ $ combination_id ] [ 'stock' ] ) ; return true ; }
docstring: Validates products cart options
  @return boolean|null
docstring_tokens: Validates products cart options