Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function getCart($with_items = false)
 {
     if (null == $this->cart) {
         $cartIdentifier = $this->storage->getCurrentCartIdentifier();
         if ($cartIdentifier) {
             if ($with_items) {
                 $cart = $this->cartManager->findCartWithItems($cartIdentifier);
             } else {
                 $cart = $this->cartManager->findCart($cartIdentifier);
             }
             if ($cart) {
                 $this->cart = $cart;
                 return $cart;
             }
         }
         $cart = $this->cartManager->createCart();
         $this->cartManager->persistCart($cart);
         $this->storage->setCurrentCartIdentifier($cart);
         $this->cart = $cart;
     }
     return $this->cart;
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 public function save(Cart $cart)
 {
     $this->cartManager->persistCart($cart);
 }