protected function getCartIdentifier()
 {
     if ($this->cartProvider->getCurrentCart() instanceof CartInterface) {
         return $this->cartProvider->getCurrentCart()->getId();
     }
     return 0;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $cart = $this->cartProvider->getCurrentCart();
     $shippingMethod = $form->addChild($this->getElement('radio_group', ['name' => 'shippingMethodCost', 'label' => $this->trans('cart.shipping_method.label'), 'options' => [], 'transformer' => $this->getRepositoryTransformer('entity', $this->get('shipping_method_cost.repository'))]));
     $this->addShippingOptions($shippingMethod, $cart);
     $paymentMethod = $form->addChild($this->getElement('radio_group', ['name' => 'paymentMethod', 'label' => $this->trans('cart.payment_method.label'), 'options' => [], 'transformer' => $this->getRepositoryTransformer('entity', $this->get('payment_method.repository'))]));
     $this->addPaymentOptions($paymentMethod, $cart);
     $form->addFilter($this->getFilter('no_code'));
     $form->addFilter($this->getFilter('trim'));
     $form->addFilter($this->getFilter('secure'));
 }
Ejemplo n.º 3
0
 public function getGlobals()
 {
     $cart = $this->cartProvider->getCurrentCart();
     $products = $this->cartProductProvider->getProducts();
     return ['cart' => $cart, 'cartProducts' => $products];
 }