original_string: public function switchProductOptionsAjax()
      {
          $product_id = $this->getPosted('product_id');
          $field_value_ids = $this->getPosted('values', array(), true, 'array');
  
          if (empty($product_id)) {
              return array();
          }
  
          $product = $this->product->get($product_id);
          $response = $this->sku->selectCombination($product, $field_value_ids);
          $response += $product;
  
          $this->setItemPriceCalculated($response, $this->product);
          $this->setItemPriceFormatted($response, $this->price, $this->current_currency);
  
          return $response;
      }
code: public function switchProductOptionsAjax()
      {
          $product_id = $this->getPosted('product_id');
          $field_value_ids = $this->getPosted('values', array(), true, 'array');
  
          if (empty($product_id)) {
              return array();
          }
  
          $product = $this->product->get($product_id);
          $response = $this->sku->selectCombination($product, $field_value_ids);
          $response += $product;
  
          $this->setItemPriceCalculated($response, $this->product);
          $this->setItemPriceFormatted($response, $this->price, $this->current_currency);
  
          return $response;
      }
code_tokens: public function switchProductOptionsAjax ( ) { $ product_id = $ this -> getPosted ( 'product_id' ) ; $ field_value_ids = $ this -> getPosted ( 'values' , array ( ) , true , 'array' ) ; if ( empty ( $ product_id ) ) { return array ( ) ; } $ product = $ this -> product -> get ( $ product_id ) ; $ response = $ this -> sku -> selectCombination ( $ product , $ field_value_ids ) ; $ response += $ product ; $ this -> setItemPriceCalculated ( $ response , $ this -> product ) ; $ this -> setItemPriceFormatted ( $ response , $ this -> price , $ this -> current_currency ) ; return $ response ; }
docstring: Toggles product options
  @return array
docstring_tokens: Toggles product options