Esempio n. 1
0
 private function updateOrder($order_id)
 {
     $order = JTable::getInstance('orders', 'table');
     $order->load($order_id);
     if (!class_exists('BookProModelOrderInfos')) {
         AImporter::model('orderinfos');
     }
     $modelInfo = new BookProModelOrderinfos();
     $lists = array('order_id' => $order_id);
     $modelInfo->init($lists);
     $datas = $modelInfo->getData();
     $total = 0;
     switch ($order->type) {
         case 'TOUR':
             if (!class_exists('BookProModelTourPackagece')) {
                 AImporter::model('tourpackage');
             }
             foreach ($datas as $row) {
                 $modelpackprice = new BookProModelTourPackage();
                 $modelpackprice->setId($row->obj_id);
                 $price = $modelpackprice->getObject();
                 $total += $row->adult * $price->price + $row->child * $price->child_price;
             }
             $order->total = $total;
             break;
         case 'TRANSPORT':
             if (!class_exists('BookProModelTransport')) {
                 AImporter::model('transport');
             }
             foreach ($datas as $row) {
                 $modelTransport = new BookProModelTransport();
                 $modelTransport->setId($row->obj_id);
                 $trans = $modelTransport->getObject();
                 $total += $row->adult * $trans->price;
             }
             $order->total = $total;
             break;
         default:
             break;
     }
     $order->notes = JRequest::getString('notes');
     $order->order_status = JRequest::getString('order_status');
     $order->pay_status = JRequest::getString('pay_status');
     $order->store();
 }
Esempio n. 2
0
 function getObjectByID($id)
 {
     AImporter::model('orderinfos', 'customer');
     $query = 'SELECT `obj`.*, c.mobile,c.firstname,c.email FROM `' . $this->_table->getTableName() . '` AS `obj` ';
     $query .= 'LEFT JOIN `#__bookpro_customer` AS `c` ON `c`.`id` = `obj`.`user_id` ';
     $query .= 'WHERE `obj`.`id` = ' . (int) $id;
     $this->_db->setQuery($query);
     $obj =& $this->_db->loadObject();
     //load orderinfo
     $infosmode = new BookProModelOrderinfos();
     $infolists = array('order_id' => $id);
     $infosmode->init($infolists);
     $infos = $infosmode->getData();
     $obj->infos = $infos;
     //load customer
     $customerModel = new BookProModelCustomer();
     //$customerModel->setId($obj->user_id);
     $customer = $customerModel->getItem($obj->user_id);
     //getObject();
     $obj->customer = $customer;
     return $obj;
 }
Esempio n. 3
0
 function getFullObject()
 {
     AImporter::model('orderinfos', 'customer');
     $orders = $this->getData();
     //load orderinfo
     foreach ($orders as $order) {
         $infomodel = new BookProModelOrderinfos();
         $lists = array('order_id' => $order->id);
         $infomodel->init($lists);
         $infos = $infomodel->getData();
         $order->infos = $infos;
         $customerModel = new BookProModelCustomer();
         //$customerModel->setId($order->user_id);
         $customer = $customerModel->getItem($order->user_id);
         //getObject();
         $order->customer = $customer;
     }
     //load customer/
     return $orders;
 }