public function actionView($id) { $this->layout = '@vendor/pistol88/yii2-order/views/layouts/mini'; $model = $this->findModel($id); if ($model->status == $this->module->defaultStatus) { $model->status = $this->module->operatorOpenStatus; $model->seller_user_id = yii::$app->user->id; $model->save(false); } $searchModel = new ElementSearch(); $params = yii::$app->request->queryParams; if (!is_array($params)) { $params = []; } $params['ElementSearch']['order_id'] = $model->id; $dataProvider = $searchModel->search($params); $paymentTypes = ArrayHelper::map(PaymentType::find()->all(), 'id', 'name'); $shippingTypes = ArrayHelper::map(ShippingType::find()->all(), 'id', 'name'); $fieldFind = Field::find(); return $this->render('view', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'shippingTypes' => $shippingTypes, 'fieldFind' => $fieldFind, 'paymentTypes' => $paymentTypes, 'model' => $model]); }
public function actionPrint($id) { $this->layout = 'print'; $this->enableCsrfValidation = false; $model = $this->findModel($id); $searchModel = new ElementSearch(); $params = yii::$app->request->queryParams; if (empty($params['ElementSearch'])) { $params = ['ElementSearch' => ['order_id' => $model->id]]; } $dataProvider = $searchModel->search($params); $paymentTypes = ArrayHelper::map(PaymentType::find()->all(), 'id', 'name'); $shippingTypes = ArrayHelper::map(ShippingType::find()->all(), 'id', 'name'); $fieldFind = Field::find(); return $this->render('print', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'shippingTypes' => $shippingTypes, 'fieldFind' => $fieldFind, 'paymentTypes' => $paymentTypes, 'module' => $this->module, 'model' => $model]); }