Пример #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;
 }
Пример #2
0
 public function equals(CartItem $item)
 {
     return $this->getProductSet()->getId() === $item->getProductSet()->getId();
 }