original_string: protected function attachSku(array &$product)
      {
          if (empty($product)) {
              return $product;
          }
  
          $product['default_field_values'] = array();
          $codes = (array) $this->sku->getList(array('product_id' => $product['product_id']));
  
          foreach ($codes as $code) {
  
              if ($code['combination_id'] === '') {
                  $product['sku'] = $code['sku'];
                  $product['price'] = $code['price'];
                  $product['stock'] = $code['stock'];
                  continue;
              }
  
              $product['combination'][$code['combination_id']] = $code;
  
              if (!empty($code['is_default'])) {
                  $product['default_field_values'] = $code['fields'];
              }
          }
  
          return $product;
      }
code: protected function attachSku(array &$product)
      {
          if (empty($product)) {
              return $product;
          }
  
          $product['default_field_values'] = array();
          $codes = (array) $this->sku->getList(array('product_id' => $product['product_id']));
  
          foreach ($codes as $code) {
  
              if ($code['combination_id'] === '') {
                  $product['sku'] = $code['sku'];
                  $product['price'] = $code['price'];
                  $product['stock'] = $code['stock'];
                  continue;
              }
  
              $product['combination'][$code['combination_id']] = $code;
  
              if (!empty($code['is_default'])) {
                  $product['default_field_values'] = $code['fields'];
              }
          }
  
          return $product;
      }
code_tokens: protected function attachSku ( array & $ product ) { if ( empty ( $ product ) ) { return $ product ; } $ product [ 'default_field_values' ] = array ( ) ; $ codes = ( array ) $ this -> sku -> getList ( array ( 'product_id' => $ product [ 'product_id' ] ) ) ; foreach ( $ codes as $ code ) { if ( $ code [ 'combination_id' ] === '' ) { $ product [ 'sku' ] = $ code [ 'sku' ] ; $ product [ 'price' ] = $ code [ 'price' ] ; $ product [ 'stock' ] = $ code [ 'stock' ] ; continue ; } $ product [ 'combination' ] [ $ code [ 'combination_id' ] ] = $ code ; if ( ! empty ( $ code [ 'is_default' ] ) ) { $ product [ 'default_field_values' ] = $ code [ 'fields' ] ; } } return $ product ; }
docstring: Adds option combinations to the product
  @param array $product
  @return array
docstring_tokens: Adds option combinations to the product