コード例 #1
0
ファイル: ShipmentPresenter.php プロジェクト: shophp/shophp
 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:');
 }
コード例 #2
0
ファイル: CurrentCartService.php プロジェクト: shophp/shophp
 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);
         }
     }
 }
コード例 #3
0
ファイル: CartPresenter.php プロジェクト: shophp/shophp
 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');
 }