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


PHP Order::loadDefaultValues方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new Order model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     //if(!Yii::$app->user->can('createYourAuth')) throw new ForbiddenHttpException(Yii::t('app', 'No Auth'));
     $model = new Order();
     $model->loadDefaultValues();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
开发者ID:CTaiDeng,项目名称:funshop,代码行数:16,代码来源:OrderController.php

示例2: actionPurchaseNow

 public function actionPurchaseNow()
 {
     $MOLPayInfo = [];
     $order = new Order();
     $order->loadDefaultValues();
     $orderForm = new OrderForm();
     $orderForm->load(\Yii::$app->request->post());
     $order->invoice_no = 0;
     $order->invoice_prefix = date("Y-m-d") . '-00';
     $order->store_name = 'Hybrizy';
     $order->payment_method = "MOLPay";
     $order->payment_code = "molpay";
     $order->store_url = Url::base(true);
     $order->user_id = \Yii::$app->user->id;
     $order->firstname = $orderForm->payment_firstname;
     $order->lastname = $orderForm->payment_lastname;
     $order->email = $orderForm->email;
     $order->telephone = $orderForm->payment_telephone;
     $order->fax = "";
     $order->payment_firstname = $orderForm->payment_firstname;
     $order->payment_lastname = $orderForm->payment_lastname;
     $order->payment_company = "";
     $order->payment_address_1 = $orderForm->payment_address_1;
     $order->payment_address_2 = $orderForm->payment_address_2;
     $order->payment_city = $orderForm->payment_city;
     $order->payment_postcode = $orderForm->payment_postcode;
     $order->payment_country = "";
     $order->payment_zone = "";
     $order->payment_address_format = "";
     if ($orderForm->BillingInfoAsShippingAddress === '1') {
         $order->shipping_firstname = $orderForm->payment_firstname;
         $order->shipping_lastname = $orderForm->payment_lastname;
         $order->shipping_address_1 = $orderForm->payment_address_1;
         $order->shipping_address_2 = $orderForm->payment_address_2;
         $order->shipping_city = $orderForm->payment_city;
         $order->shipping_code = $orderForm->payment_code;
         $order->shipping_postcode = $orderForm->shipping_postcode;
     } else {
         $order->shipping_firstname = $orderForm->shipping_firstname;
         $order->shipping_lastname = $orderForm->shipping_lastname;
         $order->shipping_address_1 = $orderForm->shipping_address_1;
         $order->shipping_address_2 = $orderForm->shipping_address_2;
         $order->shipping_city = $orderForm->shipping_city;
         $order->shipping_code = $orderForm->shipping_code;
         $order->shipping_postcode = $orderForm->shipping_postcode;
     }
     // MOL Pay info
     $MOLPayInfo['bill_name'] = $order->payment_firstname . ' ' . $order->payment_lastname;
     $MOLPayInfo['bill_desc'] = $orderForm->BillDescription();
     $order->shipping_zone = "";
     $order->shipping_address_format = "";
     $order->shipping_method = "";
     $order->shipping_code = "";
     $order->comment = "";
     $order->order_status_id;
     $order->currency_code = "";
     $order->ip = "";
     $order->forwarded_ip = "";
     $order->user_agent = "";
     $order->accept_language = "";
     $order->user_id = \Yii::$app->user->id;
     $cart = unserialize(\Yii::$app->db->createCommand('select cart from user where id=:id')->bindValue(':id', \Yii::$app->user->id)->queryColumn()[0]);
     $order->total = $cart['grandTotal'];
     if ($order->save()) {
         $tempOrderId = $order->invoice_prefix . '-' . $order->id;
         $MOLPayInfo['orderid'] = $tempOrderId;
         $MOLPayInfo['amount'] = $order->total;
         $MOLPayInfo['bill_email'] = $order->email;
         $MOLPayInfo['bill_mobile'] = $order->telephone;
         $form = \Yii::$app->controller->renderPartial('@frontend/views/site/_molpay_progress', ['model' => $MOLPayInfo, 'merchantId' => \Yii::$app->params['merchantId']], true);
         return ['data' => $MOLPayInfo, 'result' => 1, 'merchantId' => \Yii::$app->params['merchantId'], 'html' => $form];
     } else {
         return ['data' => [], 'result' => 0];
     }
 }
开发者ID:fnoorman,项目名称:dev,代码行数:75,代码来源:CartController.php

示例3: save

 public function save()
 {
     $order = new Order();
     $order->loadDefaultValues();
     $order->invoice_no = 0;
     $order->invoice_prefix = date("Y-m-d") . '-00';
     $order->store_name = 'Hybrizy';
     if ($this->scenario == self::SCENARIO_TRIAL) {
         $order->payment_method = "Trial";
         $order->payment_code = "Trial";
         $order->firstname = $this->firstname;
         $order->lastname = $this->lastname;
     } elseif ($this->scenario === self::SCENARIO_CHECKOUT) {
         $order->payment_method = "MOLPay";
         $order->payment_code = "molpay";
         $order->telephone = $this->telephone;
         $order->firstname = Yii::$app->user->identity->profile->firstname;
         $order->lastname = Yii::$app->user->identity->profile->lastname;
         $order->payment_firstname = $this->payment_firstname;
         $order->payment_lastname = $this->payment_lastname;
         $order->lastname = $this->payment_lastname;
         $order->email = $this->email;
         $order->total = $this->total;
     }
     $order->store_url = Url::base(true);
     $order->user_id = Yii::$app->user->id;
     if ($order->save()) {
         if ($this->scenario === self::SCENARIO_CHECKOUT) {
             // Generate VCode
             $amount = $order->total;
             $merchantID = Yii::$app->params['merchantID'];
             $orderid = $order->invoice_prefix . '-' . $order->id;
             $vcode = md5($amount . $merchantID . $orderid . Yii::$app->params['verifyKey']);
             // MOLPay Tx Data setup
             $this->_mol_pay_tx_data['bill_name'] = $order->payment_firstname . ' ' . $order->payment_lastname;
             $this->_mol_pay_tx_data['bill_desc'] = $this->BillDescription();
             $this->_mol_pay_tx_data['orderid'] = $orderid;
             $this->_mol_pay_tx_data['amount'] = $order->total;
             $this->_mol_pay_tx_data['bill_email'] = $order->email;
             $this->_mol_pay_tx_data['currency'] = 'MYR';
             $this->_mol_pay_tx_data['country'] = 'MY';
             $this->_mol_pay_tx_data['bill_mobile'] = $order->telephone;
             $this->_mol_pay_tx_data['vcode'] = $vcode;
         }
         return $order;
     } else {
         return false;
     }
 }
开发者ID:fnoorman,项目名称:dev,代码行数:49,代码来源:OrderForm.php


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