コード例 #1
0
ファイル: ItemTest.php プロジェクト: extcode/cart
 /**
  * @test
  */
 public function setCartPidSetsCartPid()
 {
     $this->item->setCartPid('1');
     $this->assertSame('1', $this->item->getCartPid());
 }
コード例 #2
0
ファイル: CartController.php プロジェクト: extcode/cart
 /**
  * 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']);
 }