Esempio n. 1
0
 public function process()
 {
     $this->checkout->loadFromStore();
     $this->handleCompleteCheckout();
     $this->cart->clear();
     return new ShopModeResponse(ShopModeResponse::VIEW_MODE_SUCCESS);
 }
Esempio n. 2
0
 public function process()
 {
     // update cart with post data
     $this->cartProcessor->handlePOST($this->cart);
     $this->cart->save();
     return new ShopModeResponse();
 }
Esempio n. 3
0
 /**
  * @param HeadAPI          $api
  * @param CartWithShipping $cart
  * @param CartProcessor    $cartProcessor
  *
  * @return string
  */
 protected function getShopMode($api, $cart, $cartProcessor)
 {
     $defaultMode = $api->isTemplate() ? 'checkout' : 'cart';
     if ($cart->totalUniqueItems() <= 0) {
         return $defaultMode;
     }
     $mode = $cartProcessor->getMode($defaultMode);
     return $mode;
 }
Esempio n. 4
0
 /**
  * @param CartWithShipping $cart
  * @param                  $cartTable
  */
 protected function addCartSummary($cart, $cartTable)
 {
     $shippingCostsDisplay = new HtmlTagBuilder('tr', array('class' => 'shippingSum'), array(new HtmlTagBuilder('td', array('colspan' => '3', 'class' => 'number sumText'), array($this->i18n->translate('cartTable.shippingCosts'))), new HtmlTagBuilder('td', array('class' => 'number'), array($this->formatCurrency($cart->shipping()))), new HtmlTagBuilder('td', array('class' => 'action'), array(''))));
     $cartTable->append($shippingCostsDisplay);
     // SUM
     $sumTableElement = new HtmlTagBuilder('tr', array('class' => 'fullSum'), array(new HtmlTagBuilder('td', array('colspan' => '3', 'class' => 'number sumText'), array($this->i18n->translate('cartTable.fullPrice'))), new HtmlTagBuilder('td', array('class' => 'number'), array($this->formatCurrency($cart->totalWithShipping()))), new HtmlTagBuilder('td', array('class' => 'action'), array(''))));
     $cartTable->append($sumTableElement);
     // VAT
     $sumVatTableElement = new HtmlTagBuilder('tr', array('class' => 'vatSum'), array(new HtmlTagBuilder('td', array('colspan' => '4', 'class' => 'number sumText'), array(str_replace('%s', $this->formatCurrency($cart->taxWithShipping()), $this->i18n->translate('cartTable.includingVAT')))), new HtmlTagBuilder('td', array('class' => 'action'), array(''))));
     $cartTable->append($sumVatTableElement);
 }
Esempio n. 5
0
 /**
  * @param array       $items
  * @param string      $cartId
  * @param null|object $store
  * @param int         $shippingCosts
  * @param int         $shippingTax
  *
  * @return CartWithShipping
  */
 protected function createCart($items = array(), $cartId = 'CART_ID', $store = null, $shippingCosts = 0, $shippingTax = 0)
 {
     if (!is_object($store)) {
         $store = $this->createMock('\\Cart\\Storage\\Store', null, null, null);
     }
     $cart = new CartWithShipping($cartId, $store, $shippingCosts, $shippingTax);
     if (count($items) > 0) {
         foreach ($items as $item) {
             if (is_array($item)) {
                 $cart->add($this->createCartItem($item));
             } else {
                 $cart->add($item);
             }
         }
     }
     return $cart;
 }