original_string: public function add(array $data)
      {
          $result = null;
          $this->hook->attach('product.add.before', $data, $result, $this);
  
          if (isset($result)) {
              return (int) $result;
          }
  
          $data['created'] = $data['modified'] = GC_TIME;
          $data += array('currency' => $this->config->get('currency', 'USD'));
  
          $this->setPrice($data);
  
          $result = $data['product_id'] = $this->db->insert('product', $data);
  
          $this->setTranslations($data, $this->translation_entity, 'product', false);
          $this->setImages($data, $this->file, 'product');
  
          $this->setSku($data, false);
          $this->setSkuCombinations($data, false);
          $this->setOptions($data, false);
          $this->setAttributes($data, false);
          $this->setAlias($data, $this->alias, 'product', false);
          $this->setRelated($data, false);
  
          $this->search->index('product', $data);
          $this->hook->attach('product.add.after', $data, $result, $this);
          return (int) $result;
      }
code: public function add(array $data)
      {
          $result = null;
          $this->hook->attach('product.add.before', $data, $result, $this);
  
          if (isset($result)) {
              return (int) $result;
          }
  
          $data['created'] = $data['modified'] = GC_TIME;
          $data += array('currency' => $this->config->get('currency', 'USD'));
  
          $this->setPrice($data);
  
          $result = $data['product_id'] = $this->db->insert('product', $data);
  
          $this->setTranslations($data, $this->translation_entity, 'product', false);
          $this->setImages($data, $this->file, 'product');
  
          $this->setSku($data, false);
          $this->setSkuCombinations($data, false);
          $this->setOptions($data, false);
          $this->setAttributes($data, false);
          $this->setAlias($data, $this->alias, 'product', false);
          $this->setRelated($data, false);
  
          $this->search->index('product', $data);
          $this->hook->attach('product.add.after', $data, $result, $this);
          return (int) $result;
      }
code_tokens: public function add ( array $ data ) { $ result = null ; $ this -> hook -> attach ( 'product.add.before' , $ data , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( int ) $ result ; } $ data [ 'created' ] = $ data [ 'modified' ] = GC_TIME ; $ data += array ( 'currency' => $ this -> config -> get ( 'currency' , 'USD' ) ) ; $ this -> setPrice ( $ data ) ; $ result = $ data [ 'product_id' ] = $ this -> db -> insert ( 'product' , $ data ) ; $ this -> setTranslations ( $ data , $ this -> translation_entity , 'product' , false ) ; $ this -> setImages ( $ data , $ this -> file , 'product' ) ; $ this -> setSku ( $ data , false ) ; $ this -> setSkuCombinations ( $ data , false ) ; $ this -> setOptions ( $ data , false ) ; $ this -> setAttributes ( $ data , false ) ; $ this -> setAlias ( $ data , $ this -> alias , 'product' , false ) ; $ this -> setRelated ( $ data , false ) ; $ this -> search -> index ( 'product' , $ data ) ; $ this -> hook -> attach ( 'product.add.after' , $ data , $ result , $ this ) ; return ( int ) $ result ; }
docstring: Adds a product
  @param array $data
  @return integer
docstring_tokens: Adds a product