Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $data = [])
 {
     $query = Order::find()->where(['store_id' => $data['stores'], 'status' => Order::STATUS_ACTIVE])->with('store.orderStatuses', 'store.orderTemplate', 'store.group');
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['create_time' => SORT_DESC]]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['in', 'order_status_id', $this->order_status_id]);
     $query->andFilterWhere(['order_id' => $this->order_id, 'store_id' => $this->store_id, 'create_by' => $this->create_by, 'payment_method_id' => $this->payment_method_id, 'payment_status_id' => $this->payment_status_id, 'shipping_method_id' => $this->shipping_method_id, 'purchase_price' => $this->purchase_price, 'shipping_price' => $this->shipping_price, 'total_price' => $this->total_price, 'sale_price' => $this->sale_price, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'invoice_no', $this->invoice_no])->andFilterWhere(['like', 'payment_text', $this->payment_text])->andFilterWhere(['like', 'shipping_text', $this->shipping_text])->andFilterWhere(['like', 'shipping_tracking', $this->shipping_tracking])->andFilterWhere(['like', 'comment', $this->comment])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'forwarded_ip', $this->forwarded_ip])->andFilterWhere(['like', 'user_agent', $this->user_agent]);
     if (isset($this->create_time) && $this->create_time != '') {
         $c_filter = explode(' to ', $this->create_time);
         $this->c_time_start = Yii::$app->formatter->asDatetime($c_filter[0], "php:Y-m-d 00:00:00");
         $this->c_time_end = Yii::$app->formatter->asDatetime($c_filter[1], "php:Y-m-d 23:59:59");
         $query->andFilterWhere(['between', 'create_time', $this->c_time_start, $this->c_time_end]);
     }
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Order::className(), ['store_id' => 'store_id']);
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Order::className(), ['order_status_id' => 'order_status_id']);
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(Order::className(), ['order_id' => 'order_id']);
 }
Exemplo n.º 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Order::className(), ['payment_method_id' => 'payment_method_id']);
 }
 /**
  * Finds the Order model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Order the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $model = Order::find()->where(['order_id' => $id, 'store_id' => array_keys($this->subData['userStores'])])->one();
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return string
  */
 public function getAttributeLabelValue()
 {
     $labels = Order::attributeLabels();
     return $labels[$this->attribute_name];
 }
 protected function getOrderAttributes()
 {
     $model = new Order();
     return $model->getOrderAttributes();
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Order::className(), ['shipping_method_id' => 'shipping_method_id']);
 }