Пример #1
0
 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);
 }