Exemplo n.º 1
0
 /**
  * @return  TCVM_Product_Interface
  */
 public static function Factory()
 {
     if (!self::$_instance) {
         self::$_instance = new TCVM_Product_Imple();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
 function __construct()
 {
     $this->_product = TCVM_Product_Factory::Factory();
 }
Exemplo n.º 3
0
 public function demoAction()
 {
     $productMod = TCVM_Product_Factory::Factory();
     $courses = $productMod->getCourses();
     $this->assign("courses", $courses);
 }
Exemplo n.º 4
0
 private function _cacludePrice(&$cartInfo)
 {
     $productMod = TCVM_Product_Factory::Factory();
     $products = $cartInfo[self::STEP_PRODUCT]["products"];
     $deduct = $cartInfo[self::STEP_PRODUCT]["deduct"];
     $rtn = 0;
     //if a new user, add 100$fee
     if ($cartInfo[self::STEP_PRODUCT]["new"]) {
         $rtn += self::NEW_USER_FEE;
     }
     if (is_array($products)) {
         //if re-token course
         foreach ($products as $id => $product) {
             $item = $productMod->getById($id);
             $price = $item["price"][$product["type"]];
             if ($this->_myReTokenCourse($id)) {
                 $price = $price * (1 - self::RETOKEN_DISCOUNT);
                 $cartInfo["info"][$id] = $item["name"] . "get " . self::RETOKEN_DISCOUNT * 100 . "% discount";
             }
             $rtn += $price;
             $cartInfo[self::STEP_PRODUCT]["products"][$id]["price"] = $price;
         }
     }
     if ($deduct && key_exists("5", $products)) {
         $rtn = $rtn - self::FIFTH_SESSION_DEDUCT;
         $cartInfo[self::STEP_PRODUCT]["products"][5]["price"] = $cartInfo[self::STEP_PRODUCT]["products"][5]["price"] - self::FIFTH_SESSION_DEDUCT;
     }
     return $rtn;
 }
Exemplo n.º 5
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;
 }
Exemplo n.º 6
0
 public function init()
 {
     $this->_product = TCVM_Product_Factory::Factory();
 }