Example #1
0
 /**
  * {@inheritdoc}
  */
 public function createItem(CartItem $CartItem)
 {
     $class = $this->getClass();
     $item = new $class();
     $title = $CartItem->getProductSet()->getProduct()->getTitle();
     if ($CartItem->getProductSet()->getProductSize()) {
         $title .= ' ' . $CartItem->getProductSet()->getProductSize()->getTitle();
     }
     if ($CartItem->getProductSet()->getProductOption()) {
         $title .= '/' . $CartItem->getProductSet()->getProductOption()->getTitle();
     }
     $item->setTitle($title);
     $item->setProductSet($CartItem->getProductSet());
     $item->setPrice($CartItem->getProductSet()->getProduct()->getStorePrice());
     $item->setQuantity($CartItem->getQuantity());
     return $item;
 }
Example #2
0
 /**
  * Add cart_items
  *
  * @param Chewbacca\CartBundle\Entity\CartItem $cartItems
  */
 public function addCartItem(\Chewbacca\CartBundle\Entity\CartItem $cartItem)
 {
     $this->cart_items[] = $cartItem;
     $cartItem->setCart($this);
 }
Example #3
0
 public function equals(CartItem $item)
 {
     return $this->getProductSet()->getId() === $item->getProductSet()->getId();
 }