Exemplo n.º 1
0
 private function updateShipment(ShipmentForm $form)
 {
     $values = $form->getValues();
     $shipmentOption = $form->getChosenShipment();
     if (isset($values->address)) {
         $this->cartService->createShipmentForCart($this->currentCartService->getCurrentCart(), $shipmentOption, $values->address->name, $values->address->street, $values->address->city, $values->address->zip);
     } else {
         $this->cartService->createShipmentForCart($this->currentCartService->getCurrentCart(), $shipmentOption);
     }
     $this->currentCartService->saveCurrentCart();
     $this->redirect(':Front:Order:Payment:');
 }
Exemplo n.º 2
0
 public function saveCurrentCart()
 {
     $cart = $this->getCurrentCart();
     if ($cart->hasItems()) {
         if ($cart->getId() === null) {
             $this->cartService->create($cart);
             $this->cartSession->cartId = $cart->getId();
         } else {
             $this->cartService->update($cart);
         }
     }
 }
Exemplo n.º 3
0
 private function recalculateCart(CartForm $form)
 {
     $removeItemId = $form->getRemoveItemId();
     if ($removeItemId !== null) {
         $this->cartService->removeItemFromCart($this->cartService->getItemById($removeItemId));
     } else {
         $values = $form->getValues();
         foreach ($values->amount as $itemId => $amount) {
             $item = $this->cartService->getItemById($itemId);
             $item->setAmount($amount);
             $this->currentCartService->saveCurrentCart();
         }
     }
     $this->flashMessage('Cart has been recalculated.');
     $this->redirect('this');
 }