Ejemplo n.º 1
0
 /**
  * Action order Cart
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem
  * @param \Extcode\Cart\Domain\Model\Order\Address $billingAddress
  * @param \Extcode\Cart\Domain\Model\Order\Address $shippingAddress
  *
  * @ignorevalidation $shippingAddress
  *
  * @return void
  */
 public function orderCartAction(\Extcode\Cart\Domain\Model\Order\Item $orderItem = null, \Extcode\Cart\Domain\Model\Order\Address $billingAddress = null, \Extcode\Cart\Domain\Model\Order\Address $shippingAddress = null)
 {
     if ($orderItem == null || $billingAddress == null) {
         $this->redirect('showCart');
     }
     $this->cart = $this->cartUtility->getCartFromSession($this->settings['cart'], $this->pluginSettings);
     if ($this->cart->getCount() == 0) {
         $this->redirect('showCart');
     }
     $this->parseData();
     $this->orderUtility->checkStock($this->cart);
     $orderItem->setCartPid(intval($GLOBALS['TSFE']->id));
     if ($this->request->hasArgument('shipping_same_as_billing')) {
         $isShippingAddressSameAsBilling = $this->request->getArgument('shipping_same_as_billing');
         if ($isShippingAddressSameAsBilling == 'true') {
             $shippingAddress = null;
             $orderItem->removeShippingAddress();
         }
     }
     $this->orderUtility->saveOrderItem($this->pluginSettings, $this->cart, $orderItem, $billingAddress, $shippingAddress);
     $this->orderUtility->handleStock($this->cart);
     $this->orderUtility->handlePayment($orderItem, $this->cart);
     $this->orderUtility->autoGenerateDocuments($orderItem, $this->pluginSettings);
     $this->sendMails($orderItem, $billingAddress, $shippingAddress);
     $this->view->assign('cart', $this->cart);
     $this->view->assign('orderItem', $orderItem);
     $paymentId = $this->cart->getPayment()->getId();
     if (intval($this->pluginSettings['payments']['options'][$paymentId]['preventClearCart']) != 1) {
         $this->cart = $this->cartUtility->getNewCart($this->settings['cart'], $this->pluginSettings);
     }
     $this->sessionHandler->writeToSession($this->cart, $this->settings['cart']['pid']);
 }
Ejemplo n.º 2
0
 /**
  * Generate an Invoice Number
  *
  * @param \Extcode\Cart\Domain\Model\Order\Item $orderItem
  *
  * @return int
  */
 protected function generateInvoiceNumber(\Extcode\Cart\Domain\Model\Order\Item $orderItem)
 {
     $this->buildTSFE();
     $cartConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_cart.'];
     /**
      * @var \TYPO3\CMS\Extbase\Service\TypoScriptService $typoScriptService
      */
     $typoScriptService = $this->objectManager->get(\TYPO3\CMS\Extbase\Service\TypoScriptService::class);
     $configurationManager = $this->objectManager->get(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class);
     $cartConfiguration = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
     if ($cartConfiguration) {
         $pluginTypoScriptSettings = $typoScriptService->convertTypoScriptArrayToPlainArray($cartConfiguration);
     }
     //TODO replace it width dynamic var
     $pluginTypoScriptSettings['settings'] = ['cart' => ['pid' => $orderItem->getCartPid()]];
     $invoiceNumber = $this->orderUtility->getInvoiceNumber($pluginTypoScriptSettings);
     return $invoiceNumber;
 }