示例#1
0
 public function getCurrentCart()
 {
     if ($this->cartContext->hasCurrentCart()) {
         return $this->cartContext->getCurrentCart();
     }
     return null;
 }
 /**
  * {@inheritdoc}
  */
 public function getQueryBuilder(ColumnCollection $columns, DataSetRequestInterface $request) : QueryBuilder
 {
     $queryBuilder = parent::getQueryBuilder($columns, $request);
     $expression = $queryBuilder->expr()->eq('cart_product.cart', ':cart');
     $queryBuilder->andWhere($expression);
     $queryBuilder->setParameter('cart', $this->cartContext->getCurrentCartIdentifier());
     $queryBuilder->setParameter('date', (new \DateTime())->setTime(0, 0, 1));
     return $queryBuilder;
 }
 /**
  * {@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'));
 }
示例#4
0
 public function getGlobals()
 {
     return ['cart' => $this->cartContext->getCurrentCart(), 'cartProducts' => $this->cartProductDataSet->getResult('array')];
 }