示例#1
0
 public function getCurrentCart()
 {
     if ($this->cartContext->hasCurrentCart()) {
         return $this->cartContext->getCurrentCart();
     }
     return null;
 }
 /**
  * {@inheritdoc}
  */
 public function buildForm(FormInterface $form)
 {
     $cart = $this->cartContext->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'));
 }
示例#3
0
 public function getGlobals()
 {
     return ['cart' => $this->cartContext->getCurrentCart(), 'cartProducts' => $this->cartProductDataSet->getResult('array')];
 }