当前位置: 首页>>代码示例>>PHP>>正文


PHP Orders::save方法代码示例

本文整理汇总了PHP中Orders::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Orders::save方法的具体用法?PHP Orders::save怎么用?PHP Orders::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Orders的用法示例。


在下文中一共展示了Orders::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Orders();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Orders'])) {
         $model->attributes = $_POST['Orders'];
         $model->order_sn = F::get_order_sn();
         $model->user_id = Yii::app()->user->id ? Yii::app()->user->id : '0';
         if ($model->save()) {
             $cart = Yii::app()->cart;
             $mycart = $cart->contents();
             foreach ($mycart as $mc) {
                 $orderGoods = new OrderGoods();
                 $orderGoods->order_id = $model->order_id;
                 $orderGoods->product_id = $mc['id'];
                 $orderGoods->product_name = $mc['product_name'];
                 $orderGoods->product_image = serialize($mc['product_image']);
                 $orderGoods->product_sn = $mc['product_sn'];
                 $orderGoods->qty = $mc['qty'];
                 $orderGoods->save();
             }
             $cart->destroy();
             $this->redirect(array('success'));
         }
     }
     //
     //        $this->render('create', array(
     //            'model' => $model,
     //        ));
 }
开发者ID:rainsongsky,项目名称:yincart,代码行数:35,代码来源:OrderController1.php

示例2: testGetAnnualMonthlyReport

 public function testGetAnnualMonthlyReport()
 {
     /*insert last month*/
     foreach (range(0, 5) as $key => $value) {
         /*insert 5 orders row*/
         $newOrder = new Orders();
         $newOrder->paid = 5000.0;
         $newOrder->order_date = (string) Carbon::parse('monday last month');
         $newOrder->save(false);
     }
     foreach (range(0, 5) as $key => $value) {
         /*insert 5 orders row*/
         $newOrder = new Orders();
         $newOrder->paid = 5000.0;
         $newOrder->order_date = (string) Carbon::parse('monday this month');
         $newOrder->save(false);
     }
     /*insert this month*/
     $reportArr = $this->annualReport->getAnnualMonthlyReport();
     /*check if Month is complete*/
     $this->assertNotNull($reportArr['January'], 'Check if January is in the report');
     $this->assertNotNull($reportArr['February'], 'Check if February is in the report');
     $this->assertNotNull($reportArr['March'], 'Check if March is in the report');
     $this->assertNotNull($reportArr['April'], 'Check if April is in the report');
     $this->assertNotNull($reportArr['May'], 'Check if May is in the report');
     $this->assertNotNull($reportArr['June'], 'Check if June is in the report');
     $this->assertNotNull($reportArr['July'], 'Check if July is in the report');
     $this->assertNotNull($reportArr['August'], 'Check if August is in the report');
     $this->assertNotNull($reportArr['September'], 'Check if September is in the report');
     $this->assertNotNull($reportArr['October'], 'Check if October is in the report');
     $this->assertNotNull($reportArr['November'], 'Check if November is in the report');
     $this->assertNotNull($reportArr['December'], 'Check if December is in the report');
     $this->assertEquals($reportArr['October'], 30000, 'Make sure total is 30000');
     $this->assertEquals($reportArr['November'], 30000, 'Make sure total is 30000');
 }
开发者ID:kevindaus,项目名称:Order-Billing-Inventory-System-Marcials-Furniture,代码行数:35,代码来源:AnnualReportTest.php

示例3: add

 /**
  * Validates data submitted in the add form. If the validation fails,
  * displays the add page. Otherwise, creates a new order, saves it and
  * its products to the database and clears the 'cart' session variable. 
  * Redirects to the front page.
  */
 public static function add()
 {
     $params = $_POST;
     date_default_timezone_set('Europe/Helsinki');
     $attributes = array('user_id' => $params['user_id'], 'first_name' => $params['first_name'], 'last_name' => $params['last_name'], 'phone_number' => $params['phone_number'], 'street_address' => $params['street_address'], 'postal_code' => $params['postal_code'], 'city' => $params['city'], 'delivery_method' => $params['delivery_method']);
     $validator = self::order_validator($attributes);
     if ($validator->validate()) {
         $order = new Orders(array('user_id' => $attributes['user_id'], 'order_time' => date('d-m-Y H:i:s'), 'actual_delivery_time' => null, 'delivery_address' => $attributes['street_address'] . ', ' . $attributes['postal_code'] . ' ' . $attributes['city'], 'delivery_method' => $attributes['delivery_method'], 'total_price' => $_SESSION['cart']['price'], 'status' => 'Jonossa'));
         if (!$params['user_id']) {
             $user = array('user_id' => null, 'first_name' => $params['first_name'], 'last_name' => $params['last_name'], 'phone_number' => $params['phone_number']);
             $order->user_id = null;
             $order->user_info = json_encode($user);
         } else {
             $order->user_info = json_encode(Users::findOne($_SESSION['user']));
         }
         if ($order->delivery_method == 'Nouto') {
             $order->agreed_delivery_time = date('d-m-Y H:i:s', strtotime('+15 minutes', strtotime($order->order_time)));
         } else {
             $order->agreed_delivery_time = date('d-m-Y H:i:s', strtotime('+60 minutes', strtotime($order->order_time)));
         }
         $order_id = $order->save();
         self::set_order_products($order_id, $_SESSION['cart']['items']);
         $_SESSION['cart'] = null;
         Redirect::to('/', array('message' => 'Tilauksesi on lähetetty, kiitos!'));
     } else {
         View::make('order/add.html', array('errors' => $validator->errors(), 'user' => $attributes));
     }
 }
开发者ID:nadeka,项目名称:pizzataivas,代码行数:34,代码来源:orders_controller.php

示例4: create

 public static function create()
 {
     $model = new Orders();
     $dateCreated = new DateTime('now');
     $model->created = $dateCreated->format('Y-m-d H:i:s');
     $model->status = Orders::STATUS_CREATED;
     if ($model->save()) {
         return $model->id;
     } else {
         return false;
     }
 }
开发者ID:norv95,项目名称:kmptest,代码行数:12,代码来源:Orders.php

示例5: storeData

 public function storeData($walletID)
 {
     $attributes = $this->apiAttributes();
     //Retrieve the XML dataset
     $orders = $this->getEVEData($walletID);
     $character = Characters::Model()->findByPk($walletID);
     Orders::Model()->deleteAll('charID=:charID', array(':charID' => $character->characterID));
     foreach ($orders->result->rowset->row as $row) {
         $exist = Orders::Model()->exists('orderID=:orderID', array(':orderID' => $row->attributes()->orderID));
         if (!$exist) {
             //echo "ORDERID: {$row->attributes()->orderID} <br>";
             $orderRow = new Orders();
             $orderRow->orderID = $row->attributes()->orderID;
             $orderRow->charID = $row->attributes()->charID;
             $orderRow->stationID = $row->attributes()->stationID;
             $orderRow->volEntered = $row->attributes()->volEntered;
             $orderRow->volRemaining = $row->attributes()->volRemaining;
             $orderRow->minVolume = $row->attributes()->minVolume;
             $orderRow->orderState = $row->attributes()->orderState;
             $orderRow->typeID = $row->attributes()->typeID;
             $orderRow->range = $row->attributes()->range;
             $orderRow->accountKey = $row->attributes()->accountKey;
             $orderRow->duration = $row->attributes()->duration;
             $orderRow->escrow = $row->attributes()->escrow;
             $orderRow->price = $row->attributes()->price;
             $orderRow->bid = $row->attributes()->bid;
             $orderRow->issued = $row->attributes()->issued;
             $orderRow->save();
             //print_r($orderRow->getErrors());
         } else {
             //echo "ORDERID: {$row->attributes()->orderID} <br>";
             $orderRow = Orders::Model()->findByPk($row->attributes()->orderID);
             $orderRow->orderID = $row->attributes()->orderID;
             $orderRow->charID = $row->attributes()->charID;
             $orderRow->stationID = $row->attributes()->stationID;
             $orderRow->volEntered = $row->attributes()->volEntered;
             $orderRow->volRemaining = $row->attributes()->volRemaining;
             $orderRow->minVolume = $row->attributes()->minVolume;
             $orderRow->orderState = $row->attributes()->orderState;
             $orderRow->typeID = $row->attributes()->typeID;
             $orderRow->range = $row->attributes()->range;
             $orderRow->accountKey = $row->attributes()->accountKey;
             $orderRow->duration = $row->attributes()->duration;
             $orderRow->escrow = $row->attributes()->escrow;
             $orderRow->price = $row->attributes()->price;
             $orderRow->bid = $row->attributes()->bid;
             $orderRow->issued = $row->attributes()->issued;
             $orderRow->save();
             //print_r($orderRow->getErrors());
         }
     }
 }
开发者ID:Covert-Inferno,项目名称:prohd,代码行数:52,代码来源:APIOrders.php

示例6: actionCreate

 public function actionCreate()
 {
     $model = new Orders();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Orders'])) {
         $model->attributes = $_POST['Orders'];
         $model->start = date("Y-m-d", strtotime($_POST['Orders']['start']));
         $model->stop = date("Y-m-d", strtotime($_POST['Orders']['stop']));
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:laptopsr,项目名称:miinus,代码行数:15,代码来源:OrdersController.php

示例7: paymentAction

 public function paymentAction()
 {
     if ($this->request->isPost()) {
         $orderarray = $this->request->getPost('orderarray');
         $orderarray = json_decode($orderarray, TRUE);
         $sum = 0;
         foreach ($orderarray as $veg) {
             $sum += $veg[m_price] * $veg[quant];
         }
         //echo $sum;
         $auth = $this->session->get('auth');
         $id = $auth[uid];
         $orders = new Orders();
         $orders->u_id = $id;
         $orders->o_price = $sum;
         $orders->o_date = date("Y-m-d");
         $orders->o_payment = "Failed";
         $orders->o_delivery = 0;
         if ($orders->save() == false) {
             foreach ($orders->getMessages() as $message) {
                 echo $message;
             }
         } else {
             foreach ($orderarray as $veg) {
                 $orderdetails = new Orderdetails();
                 $orderdetails->o_id = $orders->o_id;
                 $orderdetails->m_id = $veg[m_id];
                 $orderdetails->od_quantity = $veg[quant];
                 $orderdetails->od_prepared = 0;
                 if ($orderdetails->save() == false) {
                     foreach ($orderdetails->getMessages() as $message) {
                         echo $message;
                     }
                 } else {
                     $user = Userdetails::findFirst(array("(u_id = :id:)", 'bind' => array('id' => $id)));
                     if ($user != false) {
                         $datename = $user->u_fname;
                         $dataemail = $user->u_email;
                         $dataphone = $user->u_phno;
                         $dataamount = $sum;
                         $url = "https://www.instamojo.com/slickaccount/test-for-integration-monthly-payment/?intent=buy&data_name=" . $dataname . "&data_email=" . $dataemail . "&data_phone=" . $dataphone . "&data_amount=" . $dataamount . "&data_readonly=data_phone&data_readonly=data_name&data_readonly=data_email";
                         header('Location: ' . $url);
                     }
                 }
             }
         }
     }
 }
开发者ID:redefiningcuriosity,项目名称:rms,代码行数:48,代码来源:PlaceorderController.php

示例8: add

 public function add($order_sn, $user_id, $company_id = 0, $box_id = '', $payment_id = 0, $payment = "", $goods_id = 0, $money = 0, $status = 0, $remark = "", $count = 0)
 {
     $bean = new Orders();
     $bean->order_sn = $order_sn;
     $bean->user_id = $user_id;
     $bean->company_id = $company_id;
     $bean->box_id = $box_id;
     $bean->payment_id = $payment_id;
     $bean->payment = $payment;
     $bean->goods_id = $goods_id;
     $bean->money = $money;
     $bean->status = $status;
     $bean->remark = $remark;
     $bean->count = $count;
     return $bean->save();
 }
开发者ID:infi000,项目名称:geek,代码行数:16,代码来源:tvmorders.class.php

示例9: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Orders();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Orders'])) {
         $model->attributes = $_POST['Orders'];
         if ($model->save()) {
             $msg = 'Заказ #' . $model->id . ' - ' . $model->name . ' для ' . $model->client->name . ' создан';
             Yii::app()->user->setFlash('success', $msg);
             Yii::app()->logger->write($msg);
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:ASDAFF,项目名称:its-crm,代码行数:20,代码来源:OrdersController.php

示例10: actionStep2

 public function actionStep2($id, $day)
 {
     $models_orders = new Orders();
     if (isset($_POST['Orders'])) {
         $models_orders->name = $_POST['Orders']['name'];
         $models_orders->tel = $_POST['Orders']['tel'];
         $models_orders->selected_time_id = $_POST['selected_time_id'];
         $models_orders->quest_id = $_GET['id'];
         $models_orders->date_day = $_GET['day'];
         $models_orders->setScenario('insert');
         if ($models_orders->save()) {
             $this->redirect('/site/success');
         }
     }
     $this->render('step2', array('model' => $this->loadModel($id), 'day' => $date_day, 'models_orders' => $models_orders));
 }
开发者ID:R-thomas,项目名称:quest,代码行数:16,代码来源:SiteController.php

示例11: checkoutAction

 public function checkoutAction()
 {
     $id = $this->session->get('user_id');
     $orderList = TempOrder::find("user_id = '{$this->session->get('user_id')}'");
     foreach ($orderList as $key => $value) {
         $order = new Orders();
         $order->id = UUID::v4();
         $order->stadium = $value->stadium;
         $order->start_hour = $value->start_hour;
         $order->end_hour = $value->end_hour;
         $order->user_id = $value->user_id;
         $order->date_created = Carbon::now()->toDateString();
         $order->save();
         $value->delete();
     }
     $this->response->redirect('/dashboard');
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:17,代码来源:ProcessController.php

示例12: actionCreate

 /**
  * Creates a new model.
  * @param integer $id the default Car Id
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($car = null)
 {
     $model = new Orders('insert');
     if (!empty($car)) {
         $model->car_id = $car;
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Orders'])) {
         $model->attributes = $_POST['Orders'];
         $model->user_id = Yii::app()->user->id;
         if ($model->save()) {
             $this->redirect(array('reservation/index'));
         }
     }
     //$model->car_id = Yii::app()->request->getParam('id');
     $this->render('create', array('model' => $model));
 }
开发者ID:nwz-orientationsys,项目名称:carsWebsite,代码行数:23,代码来源:ReservationController.php

示例13: storeOrderIntoDB

 public function storeOrderIntoDB()
 {
     foreach ($this->placedOrder->basket as $item) {
         $order = new Orders();
         $order->deviceid = $this->placedOrder->deviceID;
         $order->name = $this->placedOrder->name;
         $order->delivery_location = $this->placedOrder->deliveryLocation;
         $order->timeplaced = new CDbExpression('NOW()');
         $order->status = "placed";
         $order->item = $item->item;
         $order->quantity = $item->quantity;
         $order->orderNo = $this->placedOrder->orderNumber;
         //$order->station = $item->station;
         $order->save();
     }
     /*$order->item = $this->placedOrder->wtf;
     		//$order->deliverylocation = $this->placedOrder->shit;
     		$order->save();*/
 }
开发者ID:nsawant942,项目名称:Canteen-Management-Software-System--Witwatersrand,代码行数:19,代码来源:PlaceOrder.php

示例14: actionAdd

 public function actionAdd()
 {
     $this->layout = '//layouts/admin';
     $this->pageTitle = 'Новый заказ';
     $this->breadcrumbs = array('Заказы' => array('/admin/orders'), 'Новый заказ');
     $success = false;
     if (isset($_POST['data'])) {
         $model = new Orders();
         $dataArray = $_POST['data'];
         $dataArray['timestamp'] = isset($dataArray['timestamp']) ? strtotime($dataArray['timestamp']) : time();
         $orderItems = json_decode($dataArray['order_items'], true);
         unset($dataArray['order_items']);
         $model->setAttributes($dataArray);
         if ($model->save()) {
             $success = true;
             if (is_array($orderItems) && count($orderItems)) {
                 foreach ($orderItems as $oItem) {
                     foreach ($oItem as $oId => $amount) {
                         $object = CatalogObjects::model()->findByPk($oId);
                         if (is_object($object) && $amount) {
                             $oItemModel = new OrderItems();
                             $attributes = array();
                             $attributes['order_id'] = $model->id;
                             $attributes['name'] = $object->name;
                             $attributes['product_id'] = $object->id;
                             $attributes['price'] = $object->price;
                             $attributes['amount'] = $amount;
                             $oItemModel->setAttributes($attributes);
                             $oItemModel->save();
                         }
                     }
                 }
             }
         }
     }
     if ($success) {
         $this->redirect("/admin/orders");
     }
     if (!isset($model) || !is_object($model)) {
         $model = new Orders();
     }
     $this->render('add', array('model' => $model, 'errors' => $model->errors));
 }
开发者ID:42point,项目名称:Vinum,代码行数:43,代码来源:DefaultController.php

示例15: bidderdeposit

 public function bidderdeposit()
 {
     $order = new Orders();
     $order->desn = Auth::user()->id;
     $order->fee = 200;
     $order->fee = 0.01;
     //must comment
     $order->step = 3;
     //这是商家支付保证金
     $order->status = 0;
     $order->title = Auth::user()->username . "-支付保证金";
     $order->details = Auth::user()->username . "-支付保证金";
     $order->showurl = "http://www.51jinggou.com/demand/show/1";
     $order->save();
     $this->payorder($order->id);
 }
开发者ID:jiangyukun,项目名称:jingou,代码行数:16,代码来源:PayController.php


注:本文中的Orders::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。