Example #1
0
 /**
  * add a product to the cart
  * 
  * @param tpyProductInterface $product
  * @param int                     $count
  */
 public function addProduct(tpyProductInterface $product, $count = 1)
 {
     if (false == array_key_exists($product->getUid(), $this->_items)) {
         $this->_items[$product->getUid()] = new tpyCartItem();
         $this->_items[$product->getUid()]->setCount($count)->setProductData($product->toCartItem());
     } else {
         $this->_items[$product->getUid()]->increaseCount($count);
     }
 }