public function miniCartBlock() { $this->loadLanguageFile('Order'); $this->order->loadAll(); $this->order->getTotal(true); return new BlockResponse('order', $this->order->toArray()); }
public static function setOrder(CustomerOrder $order) { $session = new Session(); $session->set('CustomerOrder', $order->getID()); $currency = $order->getCurrency(); $currID = $currency->getID(); $total = $order->getTotal(); $orderArray = array('total' => array($currID => $total)); $orderArray['formattedTotal'] = array($currID => $currency->getFormattedPrice($orderArray['total'][$currID])); $orderArray['basketCount'] = $order->getShoppingCartItemCount(); $orderArray['currencyID'] = $currID; $isOrderable = $order->isOrderable(); $orderArray['isOrderable'] = is_bool($isOrderable) ? $isOrderable : false; $items = array(); foreach ($order->getPurchasedItems() as $item) { $items[] = $item->toArray(); } $orderArray['items'] = new RuleOrderContainer($items); $orderArray['items']->setCoupons($order->getCoupons()); $orderArray['items']->setTotal($total); $session->set('orderData', $orderArray); }
protected function getOrderValues(CustomerOrder $order) { $orderArray = array('total' => $order->getTotal()); $currID = $order->getCurrency()->getID(); $orderArray['currencyID'] = $currID; $orderArray['formattedTotal'] = $order->getCurrency()->getFormattedPrice($orderArray['total']); $orderArray['basketCount'] = $order->getShoppingCartItemCount(); $isOrderable = isset($GLOBALS['isOrderable']) ? $GLOBALS['isOrderable'] : $order->isOrderable(); $GLOBALS['isOrderable'] = $isOrderable; $orderArray['isOrderable'] = is_bool($isOrderable) ? $isOrderable : false; $orderArray['isShippingRequired'] = $order->isShippingRequired(); return $orderArray; }
private function assertDefaultZoneOrder(CustomerOrder $order, Currency $currency) { $this->assertEquals(100, $order->getTotal()); $shipment = $order->getShipments()->get(0); $shipmentArray = $shipment->toArray(); $this->assertEquals(9.09, round($shipmentArray['taxAmount'], 2), 'shipment array, taxAmount'); $this->assertEquals(90.91, round($shipmentArray['amount'], 2), 'shipment array, amount'); $this->assertEquals(100.0, round($shipmentArray['amount'] + $shipmentArray['taxAmount'], 2), 'shipment array, amount + taxAmount'); $this->assertEquals(100, round($shipment->getSubTotal(true), 2), '$shipment->getSubTotal(<with taxes>)'); $this->assertEquals(90.91, round($shipment->getSubTotal(false), 2), '$shipment->getSubTotal(<without taxes>)'); $arr = $order->toArray(); $this->assertEquals(100, $arr['cartItems'][0]['displayPrice']); $this->assertEquals(100, $arr['cartItems'][0]['displaySubTotal']); // $this->assertEqual(round($arr['cartItems'][0]['itemSubTotal'], 2), 90.91); }