original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Adds the product to the cart
  @param array $product
  @param array $data
  @return array
docstring_tokens: Adds the product to the cart