public function add(array $data)
    {
        $result = array();
        $this->hook->attach('wishlist.add.product.before', $data, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if ($this->wishlist->exists($data)) {
            return $this->getResultErrorExists($data);
        }

        if ($this->wishlist->exceedsLimit($data['user_id'], $data['store_id'])) {
            return $this->getResultErrorExceeds($data);
        }

        $data['wishlist_id'] = $this->wishlist->add($data);

        if (empty($data['wishlist_id'])) {
            return $this->getResultError();
        }

        $result = $this->getResultAdded($data);
        $this->hook->attach('wishlist.add.product.after', $data, $result, $this);
        return (array) $result;
    }
public function add(array $data)
    {
        $result = array();
        $this->hook->attach('wishlist.add.product.before', $data, $result, $this);

        if (!empty($result)) {
            return (array) $result;
        }

        if ($this->wishlist->exists($data)) {
            return $this->getResultErrorExists($data);
        }

        if ($this->wishlist->exceedsLimit($data['user_id'], $data['store_id'])) {
            return $this->getResultErrorExceeds($data);
        }

        $data['wishlist_id'] = $this->wishlist->add($data);

        if (empty($data['wishlist_id'])) {
            return $this->getResultError();
        }

        $result = $this->getResultAdded($data);
        $this->hook->attach('wishlist.add.product.after', $data, $result, $this);
        return (array) $result;
    }
public function add ( array $ data ) { $ result = array ( ) ; $ this -> hook -> attach ( 'wishlist.add.product.before' , $ data , $ result , $ this ) ; if ( ! empty ( $ result ) ) { return ( array ) $ result ; } if ( $ this -> wishlist -> exists ( $ data ) ) { return $ this -> getResultErrorExists ( $ data ) ; } if ( $ this -> wishlist -> exceedsLimit ( $ data [ 'user_id' ] , $ data [ 'store_id' ] ) ) { return $ this -> getResultErrorExceeds ( $ data ) ; } $ data [ 'wishlist_id' ] = $ this -> wishlist -> add ( $ data ) ; if ( empty ( $ data [ 'wishlist_id' ] ) ) { return $ this -> getResultError ( ) ; } $ result = $ this -> getResultAdded ( $ data ) ; $ this -> hook -> attach ( 'wishlist.add.product.after' , $ data , $ result , $ this ) ; return ( array ) $ result ; }
Adds a product to a wishlist and returns an array of result data
@param array $data
@return array
Adds a product to a wishlist and returns an array of result data