public function add($product_id)
    {
        $result = null;
        $this->hook->attach('product.compare.add.before', $product_id, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $product_ids = $this->getList();

        if (in_array($product_id, $product_ids)) {
            return false;
        }

        array_unshift($product_ids, $product_id);
        $this->controlLimit($product_ids);

        $result = $this->set($product_ids);
        $this->hook->attach('product.compare.add.after', $product_id, $result, $this);
        return (bool) $result;
    }
public function add($product_id)
    {
        $result = null;
        $this->hook->attach('product.compare.add.before', $product_id, $result, $this);

        if (isset($result)) {
            return (bool) $result;
        }

        $product_ids = $this->getList();

        if (in_array($product_id, $product_ids)) {
            return false;
        }

        array_unshift($product_ids, $product_id);
        $this->controlLimit($product_ids);

        $result = $this->set($product_ids);
        $this->hook->attach('product.compare.add.after', $product_id, $result, $this);
        return (bool) $result;
    }
public function add ( $ product_id ) { $ result = null ; $ this -> hook -> attach ( 'product.compare.add.before' , $ product_id , $ result , $ this ) ; if ( isset ( $ result ) ) { return ( bool ) $ result ; } $ product_ids = $ this -> getList ( ) ; if ( in_array ( $ product_id , $ product_ids ) ) { return false ; } array_unshift ( $ product_ids , $ product_id ) ; $ this -> controlLimit ( $ product_ids ) ; $ result = $ this -> set ( $ product_ids ) ; $ this -> hook -> attach ( 'product.compare.add.after' , $ product_id , $ result , $ this ) ; return ( bool ) $ result ; }
Adds a product to comparison
@param integer $product_id
@return boolean
Adds a product to comparison