Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function indexAction()
 {
     $this->addBreadCrumbItem(new BreadcrumbItem(['name' => $this->trans('cart.heading.index')]));
     $cart = $this->manager->getCurrentCart();
     $form = $this->manager->getForm($cart, ['validation_groups' => ['cart']]);
     if ($form->handleRequest()->isSubmitted()) {
         if ($form->isValid()) {
             $this->manager->updateResource($cart);
             return $this->getRouterHelper()->redirectTo('front.cart.index');
         }
         if (count($form->getError())) {
             $this->getFlashHelper()->addError('client.form.error.registration');
         }
     }
     return $this->displayTemplate('index', ['form' => $form, 'elements' => $form->getChildren(), 'shippingCost' => null !== $cart->getShippingMethodCost() ? $cart->getShippingMethodCost()->getCost() : null, 'summary' => $this->get('cart_summary.collector')->collect($cart)]);
 }