public function getRalationValue($id)
 {
     switch ($this->attribute) {
         case 'order_status_id':
             $value = OrderStatus::findOne($id);
             break;
         case 'store_id':
             $value = Store::findOne($id);
             break;
         case 'payment_method_id':
             $value = PaymentMethod::findOne($id);
             break;
         case 'payment_status_id':
             $value = PaymentStatus::findOne($id);
             break;
         case 'shipping_method_id':
             $value = ShippingMethod::findOne($id);
             break;
             // case 'order_status_id':
             //     $value = OrderStatus::findOne($id);
             //     break;
             // case 'order_status_id':
             //     $value = OrderStatus::findOne($id);
             //     break;
             // case 'order_status_id':
             //     $value = OrderStatus::findOne($id);
             //     break;
         // case 'order_status_id':
         //     $value = OrderStatus::findOne($id);
         //     break;
         // case 'order_status_id':
         //     $value = OrderStatus::findOne($id);
         //     break;
         // case 'order_status_id':
         //     $value = OrderStatus::findOne($id);
         //     break;
         default:
             # code...
             break;
     }
     if ($value !== null) {
         return $value->name;
     }
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPaymentStatus()
 {
     return $this->hasOne(PaymentStatus::className(), ['payment_status_id' => 'payment_status_id']);
 }
 protected function setSubData()
 {
     $this->subData['visibleAttributes'] = $this->module->getVisiableAttributes();
     $this->subData['editableAttributes'] = $this->module->getEditableAttributes();
     $this->subData['systemAttributes'] = $this->module->getOrderAttributes('system');
     $this->subData['storesIds'] = $this->module->getStoresIdsByUser(Yii::$app->user->id);
     $this->subData['userStores'] = $this->module->getStoresByUser(Yii::$app->user->id);
     $this->subData['orderStatuses'] = $this->module->getOrderStatusesByUser(Yii::$app->user->id);
     $this->subData['orderStatusesHtml'] = OrderStatus::getOrderStatusHtmlArray();
     $this->subData['paymentStatusesList'] = PaymentStatus::getPaymentStatusArray();
     $this->subData['paymentStatusesHtml'] = PaymentStatus::getPaymentStatusHtmlArray();
     $this->subData['paymentMethods'] = PaymentMethod::getPaymentMethodArray();
     $this->subData['shippingMethods'] = ShippingMethod::getShippingMethodArray();
 }
 /**
  * Finds the PaymentStatus model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PaymentStatus the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PaymentStatus::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function actionDefault()
 {
     $settings = Yii::$app->settings;
     $defaultValues = ['OrderSatatus' => ['key' => 'OrderSatatus', 'value' => $settings->get('orderDefaults.OrderSatatus'), 'availableValues' => OrderStatus::getOrderStatusArray()], 'PaymentStatus' => ['key' => 'PaymentStatus', 'value' => $settings->get('orderDefaults.PaymentStatus'), 'availableValues' => PaymentStatus::getPaymentStatusArray()], 'PaymentMethod' => ['key' => 'PaymentMethod', 'value' => $settings->get('orderDefaults.PaymentMethod'), 'availableValues' => PaymentMethod::getPaymentMethodArray()], 'ShippingMethod' => ['key' => 'ShippingMethod', 'value' => $settings->get('orderDefaults.ShippingMethod'), 'availableValues' => ShippingMethod::getShippingMethodArray()]];
     return $this->render('default', ['defaultValues' => $defaultValues]);
 }