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

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

        $data += array(
            'quantity' => 1,
            'user_id' => $this->cart->getUid(),
            'store_id' => $product['store_id'],
            'product_id' => $product['product_id']
        );

        $data['cart_id'] = $this->set($data);

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

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

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

        $data += array(
            'quantity' => 1,
            'user_id' => $this->cart->getUid(),
            'store_id' => $product['store_id'],
            'product_id' => $product['product_id']
        );

        $data['cart_id'] = $this->set($data);

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

        $result = $this->getResultAdded($data);
        $this->hook->attach('cart.add.product.after', $product, $data, $result, $this);
        return (array) $result;
    }
public function add ( array $ product , array $ data ) { $ result = array ( ) ; $ this -> hook -> attach ( 'cart.add.product.before' , $ product , $ data , $ result , $ this ) ; if ( ! empty ( $ result ) ) { return ( array ) $ result ; } $ data += array ( 'quantity' => 1 , 'user_id' => $ this -> cart -> getUid ( ) , 'store_id' => $ product [ 'store_id' ] , 'product_id' => $ product [ 'product_id' ] ) ; $ data [ 'cart_id' ] = $ this -> set ( $ data ) ; if ( empty ( $ data [ 'cart_id' ] ) ) { return $ this -> getResultError ( ) ; } $ result = $ this -> getResultAdded ( $ data ) ; $ this -> hook -> attach ( 'cart.add.product.after' , $ product , $ data , $ result , $ this ) ; return ( array ) $ result ; }
Adds the product to the cart
@param array $product
@param array $data
@return array
Adds the product to the cart