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;
    }
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;
    }
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 ; }
Adds a product
@param array $data
@return integer
Adds a product