Ejemplo n.º 1
0
 /**
  * @return TCVM_Order_Model_Order
  */
 public static function GetInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Ejemplo n.º 2
0
 private function _gets($conditions, $order = null, $pageNo = null, $pageSize = null)
 {
     $rtn = array();
     $product = TCVM_Product_Factory::Factory();
     $user = TCVM_User_Factory::Factory();
     $orderDatas = $this->_orderModel->getAllByConditions($conditions, $order, $pageNo, $pageSize);
     foreach ($orderDatas as $orderData) {
         $orderProductDatas = $this->_orderProductModel->getAllByConditions(array("order_id" => $orderData['id']));
         $orderInfo = $orderData;
         $orderInfo["cart_info"] = unserialize($orderInfo["cart_info"]);
         $orderInfo['products'] = array();
         $userInfo = $user->getUserById($orderInfo["user_id"]);
         $orderInfo["email"] = $userInfo["email"];
         foreach ($orderProductDatas as $orderProductData) {
             $productEntity = $product->getById($orderProductData['product_id']);
             $orderProductInfo = array();
             $orderProductInfo["id"] = $orderProductData['product_id'];
             $orderProductInfo["name"] = $productEntity['name'];
             $orderProductInfo["price"] = $orderProductData['price'];
             $orderInfo['products'][] = new TCVM_Order_Entity_OrderProduct($orderProductInfo);
         }
         $rtn[] = new TCVM_Order_Entity_Order($orderInfo);
     }
     return $rtn;
 }