diff --git a/backend/controllers/OrderController.php b/backend/controllers/OrderController.php index 5464b1d..825ac17 100755 --- a/backend/controllers/OrderController.php +++ b/backend/controllers/OrderController.php @@ -113,7 +113,9 @@ { $model = new orderProduct(); if ($model->load(Yii::$app->request->post())) { - + /** + * @var ProductVariant $modelMod + */ if (!$modelMod = ProductVariant::find() ->with([ 'product' ]) ->where([ 'sku' => $model->sku ]) diff --git a/backend/controllers/SeoCategoryController.php b/backend/controllers/SeoCategoryController.php index d749ea0..13345e9 100755 --- a/backend/controllers/SeoCategoryController.php +++ b/backend/controllers/SeoCategoryController.php @@ -73,7 +73,7 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->seo_category_id, + 'id' => $model->id, ]); } } @@ -100,7 +100,7 @@ if($model->save() && $model->transactionStatus) { return $this->redirect([ 'view', - 'id' => $model->seo_category_id, + 'id' => $model->id, ]); } } @@ -138,7 +138,7 @@ protected function findModel($id) { if(( $model = SeoCategory::find() - ->where([ 'seo_category_id' => $id ]) + ->where([ 'id' => $id ]) ->with('lang') ->one() ) !== NULL ) { diff --git a/backend/controllers/SeoController.php b/backend/controllers/SeoController.php index dd61108..37e7b80 100755 --- a/backend/controllers/SeoController.php +++ b/backend/controllers/SeoController.php @@ -45,6 +45,7 @@ /** * Lists all Seo models. + * * @return mixed */ public function actionIndex() @@ -52,10 +53,13 @@ $searchModel = new SeoSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } /** @@ -67,14 +71,18 @@ */ public function actionView($id) { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); } /** * Creates a new Seo model. * If creation is successful, the browser will be redirected to the 'view' page. + * * @return mixed */ public function actionCreate() @@ -82,19 +90,24 @@ $model = new Seo(); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->seo_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -109,19 +122,24 @@ { $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->seo_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -151,10 +169,10 @@ */ protected function findModel($id) { - if(( $model = Seo::find() - ->where([ 'seo_id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = Seo::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { diff --git a/backend/controllers/SeoDynamicController.php b/backend/controllers/SeoDynamicController.php index 5b67b28..ee6f6d0 100755 --- a/backend/controllers/SeoDynamicController.php +++ b/backend/controllers/SeoDynamicController.php @@ -57,11 +57,14 @@ $searchModel = new SeoDynamicSearch(); $dataProvider = $searchModel->search($seo_category_id, Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'seo_category' => $seo_category, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'seo_category' => $seo_category, + ] + ); } /** @@ -75,10 +78,13 @@ public function actionView($seo_category_id, $id) { $seo_category = $this->findCategory($seo_category_id); - return $this->render('view', [ - 'model' => $this->findModel($id), - 'seo_category' => $seo_category, - ]); + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + 'seo_category' => $seo_category, + ] + ); } /** @@ -94,21 +100,26 @@ $seo_category = $this->findCategory($seo_category_id); $model = new SeoDynamic(); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); $model->seo_category_id = $seo_category_id; - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'index', - 'seo_category_id' => $seo_category_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'index', + 'seo_category_id' => $seo_category_id, + ] + ); } } - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'seo_category' => $seo_category, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'seo_category' => $seo_category, + ] + ); } /** @@ -125,20 +136,25 @@ $seo_category = $this->findCategory($seo_category_id); $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'index', - 'seo_category_id' => $seo_category_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'index', + 'seo_category_id' => $seo_category_id, + ] + ); } } - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'seo_category' => $seo_category, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'seo_category' => $seo_category, + ] + ); } /** @@ -155,10 +171,12 @@ $this->findModel($id) ->delete(); - return $this->redirect([ - 'index', - 'seo_category_id' => $seo_category_id, - ]); + return $this->redirect( + [ + 'index', + 'seo_category_id' => $seo_category_id, + ] + ); } /** @@ -172,10 +190,10 @@ */ protected function findModel($id) { - if(( $model = SeoDynamic::find() - ->where([ 'seo_dynamic_id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = SeoDynamic::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { @@ -185,10 +203,10 @@ protected function findCategory($id) { - if(( $model = SeoCategory::find() - ->where([ 'seo_category_id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = SeoCategory::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { diff --git a/backend/controllers/ServiceController.php b/backend/controllers/ServiceController.php index de422c7..b375478 100755 --- a/backend/controllers/ServiceController.php +++ b/backend/controllers/ServiceController.php @@ -47,6 +47,7 @@ /** * Lists all Service models. + * * @return mixed */ public function actionIndex() @@ -54,10 +55,13 @@ $searchModel = new ServiceSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } /** @@ -69,33 +73,42 @@ */ public function actionView($id) { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); } /** * Creates a new Service model. * If creation is successful, the browser will be redirected to the 'view' page. + * * @return mixed */ public function actionCreate() { $model = new Service(); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->service_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -111,19 +124,24 @@ $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->service_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -153,7 +171,7 @@ */ protected function findModel($id) { - if(( $model = Service::findOne($id) ) !== NULL) { + if (( $model = Service::findOne($id) ) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); diff --git a/backend/controllers/SliderController.php b/backend/controllers/SliderController.php index 22c3cbf..848a690 100755 --- a/backend/controllers/SliderController.php +++ b/backend/controllers/SliderController.php @@ -1,132 +1,162 @@ [ - 'class' => AccessBehavior::className(), - 'rules' => - ['site' => - [ + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + 'access' => [ + 'class' => AccessBehavior::className(), + 'rules' => [ + 'site' => [ [ - 'actions' => ['login', 'error'], - 'allow' => true, - ] - ] - ] - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], + 'actions' => [ + 'login', + 'error', + ], + 'allow' => true, + ], + ], + ], ], - ], - ]; - } - - /** - * Lists all Slider models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new SliderSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + /** - * @var ActiveQuery $query + * Lists all Slider models. + * + * @return mixed */ - $query = $dataProvider->query; - $query->with('sliderImage'); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); - } - - /** - * Creates a new Slider model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Slider(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->slider_id]); - } else { - - - return $this->render('create', [ - 'model' => $model, - ]); + public function actionIndex() + { + $searchModel = new SliderSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + /** + * @var ActiveQuery $query + */ + $query = $dataProvider->query; + $query->with('sliderImage'); + + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } - } - - /** - * Updates an existing Slider model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect(['view', 'id' => $model->slider_id]); - } else { - return $this->render('update', [ - 'model' => $model, - ]); + + /** + * Creates a new Slider model. + * If creation is successful, the browser will be redirected to the 'view' page. + * + * @return mixed + */ + public function actionCreate() + { + $model = new Slider(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } else { + + return $this->render( + 'create', + [ + 'model' => $model, + ] + ); + } } - } - - /** - * Deletes an existing Slider model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Slider model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Slider the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Slider::findOne($id)) !== null) { - return $model; - } else { - throw new NotFoundHttpException('The requested page does not exist.'); + + /** + * Updates an existing Slider model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); + } else { + return $this->render( + 'update', + [ + 'model' => $model, + ] + ); + } + } + + /** + * Deletes an existing Slider model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the Slider model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return Slider the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (( $model = Slider::findOne($id) ) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } } } -} diff --git a/backend/controllers/SliderImageController.php b/backend/controllers/SliderImageController.php index b82c0e4..d576dfe 100755 --- a/backend/controllers/SliderImageController.php +++ b/backend/controllers/SliderImageController.php @@ -58,11 +58,14 @@ $searchModel = new SliderImageSearch(); $dataProvider = $searchModel->search($slider_id, Yii::$app->request->queryParams); - return $this->render('index', [ - 'slider_id' => $slider_id, - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); + return $this->render( + 'index', + [ + 'slider_id' => $slider_id, + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } /** @@ -75,10 +78,13 @@ */ public function actionView($slider_id, $id) { - return $this->render('view', [ - 'slider_id' => $slider_id, - 'model' => $this->findModel($slider_id, $id), - ]); + return $this->render( + 'view', + [ + 'slider_id' => $slider_id, + 'model' => $this->findModel($slider_id, $id), + ] + ); } /** @@ -93,24 +99,29 @@ { $model = new SliderImage(); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); $model->slider_id = $slider_id; - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'slider_id' => $slider_id, - 'id' => $model->slider_image_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'slider_id' => $slider_id, + 'id' => $model->id, + ] + ); } } $slider = Slider::findOne($slider_id); - return $this->render('create', [ - 'slider_id' => $slider_id, - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'slider' => $slider, - ]); + return $this->render( + 'create', + [ + 'slider_id' => $slider_id, + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'slider' => $slider, + ] + ); } /** @@ -126,23 +137,28 @@ { $model = $this->findModel($slider_id, $id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'slider_id' => $slider_id, - 'id' => $model->slider_image_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'slider_id' => $slider_id, + 'id' => $model->id, + ] + ); } } $slider = Slider::findOne($slider_id); - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'slider_id' => $slider_id, - 'slider' => $slider, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'slider_id' => $slider_id, + 'slider' => $slider, + ] + ); } /** @@ -159,10 +175,12 @@ $this->findModel($slider_id, $id) ->delete(); - return $this->redirect([ - 'index', - 'slider_id' => $slider_id, - ]); + return $this->redirect( + [ + 'index', + 'slider_id' => $slider_id, + ] + ); } /** @@ -180,12 +198,14 @@ /** * @var SliderImage $model */ - if(( $model = SliderImage::find() - ->where([ - 'slider_image_id' => $id, - 'slider_id' => $slider_id, - ]) - ->one() ) !== NULL + if (( $model = SliderImage::find() + ->where( + [ + 'id' => $id, + 'slider_id' => $slider_id, + ] + ) + ->one() ) !== null ) { return $model; } else { diff --git a/backend/models/OrderProducts.php b/backend/models/OrderProducts.php index 7b536f3..cbfd16f 100755 --- a/backend/models/OrderProducts.php +++ b/backend/models/OrderProducts.php @@ -41,6 +41,6 @@ public function getMod() { - return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'product_variant_id' ]); + return $this->hasOne(ProductVariant::className(), [ 'id' => 'product_variant_id' ]); } } \ No newline at end of file diff --git a/backend/views/seo-category/index.php b/backend/views/seo-category/index.php index ded2cf4..c98235b 100755 --- a/backend/views/seo-category/index.php +++ b/backend/views/seo-category/index.php @@ -19,32 +19,40 @@
= Html::a(Yii::t('app', 'Create Seo Category'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - [ 'class' => 'yii\grid\SerialColumn' ], - 'seo_category_id', - 'controller', - [ - 'attribute' => 'title', - 'value' => 'lang.title', - ], - 'status', - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{update} {image} {delete}', - 'buttons' => [ - 'image' => function($url, $model) { - return Html::a('', Url::toRoute([ - 'seo-dynamic/index', - 'seo_category_id' => $model->seo_category_id, - ]), [ - 'title' => \Yii::t('app', 'слайды'), - ]); - }, + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', + 'controller', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + 'status', + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{update} {image} {delete}', + 'buttons' => [ + 'image' => function ($url, $model) { + return Html::a( + '', + Url::toRoute( + [ + 'seo-dynamic/index', + 'seo_category_id' => $model->id, + ] + ), + [ + 'title' => \Yii::t('app', 'слайды'), + ] + ); + }, + ], ], ], - ], - ]); ?> + ] + ); ?> diff --git a/backend/views/seo-category/update.php b/backend/views/seo-category/update.php index f5bbbab..f061a68 100755 --- a/backend/views/seo-category/update.php +++ b/backend/views/seo-category/update.php @@ -22,7 +22,7 @@ 'label' => $model->lang->title, 'url' => [ 'view', - 'id' => $model->seo_category_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); diff --git a/backend/views/seo-dynamic/create.php b/backend/views/seo-dynamic/create.php index de1ba8b..ea7b633 100755 --- a/backend/views/seo-dynamic/create.php +++ b/backend/views/seo-dynamic/create.php @@ -23,7 +23,7 @@ 'label' => $seo_category->lang->title, 'url' => [ 'index', - 'seo_category_id' => $seo_category->seo_category_id, + 'seo_category_id' => $seo_category->id, ], ]; $this->params[ 'breadcrumbs' ][] = $this->title; @@ -32,9 +32,12 @@- = Html::a(Yii::t('app', 'Create Seo Dynamic'), Url::toRoute([ - 'create', - 'seo_category_id' => $seo_category->seo_category_id, - ]), [ 'class' => 'btn btn-success' ]) ?> + = Html::a( + Yii::t('app', 'Create Seo Dynamic'), + Url::toRoute( + [ + 'create', + 'seo_category_id' => $seo_category->id, + ] + ), + [ 'class' => 'btn btn-success' ] + ) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - [ 'class' => 'yii\grid\SerialColumn' ], - 'seo_dynamic_id', - [ - 'attribute' => 'title', - 'value' => 'lang.title', - ], - 'action', - 'fields', - 'param', - 'status', - [ - 'class' => 'yii\grid\ActionColumn', - 'buttons' => [ - 'view' => function($url, $model) { - return Html::a('', [ - 'view', - 'seo_category_id' => $model->seo_category_id, - 'id' => $model->seo_dynamic_id, - ], [ - 'title' => \Yii::t('app', 'Просмотр'), - ]); - }, - 'update' => function($url, $model) { - return Html::a('', [ - 'update', - 'seo_category_id' => $model->seo_category_id, - 'id' => $model->seo_dynamic_id, - ], [ - 'title' => \Yii::t('app', 'Редактировать'), - ]); - }, - 'delete' => function($url, $model) { - - return Html::a('', Url::toRoute([ - 'delete', - 'seo_category_id' => $model->seo_category_id, - 'id' => $model->seo_dynamic_id, - ]), [ - 'title' => Yii::t('yii', 'Delete'), - 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), - 'data-method' => 'post', - ]); - - }, + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + 'action', + 'fields', + 'param', + 'status', + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ + 'view' => function ($url, $model) { + return Html::a( + '', + [ + 'view', + 'seo_category_id' => $model->id, + 'id' => $model->id, + ], + [ + 'title' => \Yii::t('app', 'Просмотр'), + ] + ); + }, + 'update' => function ($url, $model) { + return Html::a( + '', + [ + 'update', + 'seo_category_id' => $model->seo_category_id, + 'id' => $model->id, + ], + [ + 'title' => \Yii::t('app', 'Редактировать'), + ] + ); + }, + 'delete' => function ($url, $model) { + + return Html::a( + '', + Url::toRoute( + [ + 'delete', + 'seo_category_id' => $model->seo_category_id, + 'id' => $model->id, + ] + ), + [ + 'title' => Yii::t('yii', 'Delete'), + 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), + 'data-method' => 'post', + ] + ); + + }, + ], ], ], - ], - ]); ?> + ] + ); ?> diff --git a/backend/views/seo-dynamic/update.php b/backend/views/seo-dynamic/update.php index de5e514..4339efc 100755 --- a/backend/views/seo-dynamic/update.php +++ b/backend/views/seo-dynamic/update.php @@ -13,9 +13,13 @@ * @var SeoCategory $seo_category */ - $this->title = Yii::t('app', 'Update {modelClass}: ', [ - 'modelClass' => 'Seo Dynamic', - ]) . $model->lang->title; + $this->title = Yii::t( + 'app', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Seo Dynamic', + ] + ) . $model->lang->title; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seo Categories'), 'url' => [ '/seo-category/index' ], @@ -24,15 +28,15 @@ 'label' => $seo_category->lang->title, 'url' => [ 'index', - 'seo_category_id' => $seo_category->seo_category_id, + 'seo_category_id' => $seo_category->id, ], ]; $this->params[ 'breadcrumbs' ][] = [ 'label' => $model->lang->title, 'url' => [ 'view', - 'seo_category_id' => $seo_category->seo_category_id, - 'id' => $model->seo_dynamic_id, + 'seo_category_id' => $seo_category->id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); @@ -41,9 +45,12 @@- = Html::a(Yii::t('app', 'Update'), [ - 'update', - 'id' => $model->seo_dynamic_id, - 'seo_category_id' => $seo_category->seo_category_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - = Html::a(Yii::t('app', 'Delete'), [ - 'delete', - 'id' => $model->seo_dynamic_id, - 'seo_category_id' => $seo_category->seo_category_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + = Html::a( + Yii::t('app', 'Update'), + [ + 'update', + 'id' => $model->id, + 'seo_category_id' => $seo_category->id, + ], + [ 'class' => 'btn btn-primary' ] + ) ?> + = Html::a( + Yii::t('app', 'Delete'), + [ + 'delete', + 'id' => $model->id, + 'seo_category_id' => $seo_category->id, ], - ]) ?> + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?>
- = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'seo_dynamic_id', - [ - 'label' => \Yii::t('app', 'Seo Category'), - 'value' => Html::a($seo_category->lang->title, [ - 'index', - 'seo_category_id' => $seo_category->seo_category_id, - ]), - 'format' => 'html', + = DetailView::widget( + [ + 'model' => $model, + 'attributes' => [ + 'id', + [ + 'label' => \Yii::t('app', 'Seo Category'), + 'value' => Html::a( + $seo_category->lang->title, + [ + 'index', + 'seo_category_id' => $seo_category->id, + ] + ), + 'format' => 'html', + ], + 'lang.title', + 'action', + 'fields', + 'param', + 'status', + 'lang.meta_title', + 'lang.h1', + 'lang.key', + 'lang.meta', + 'lang.meta_description', + 'lang.seo_text', ], - 'lang.title', - 'action', - 'fields', - 'param', - 'status', - 'lang.meta_title', - 'lang.h1', - 'lang.key', - 'lang.meta', - 'lang.meta_description', - 'lang.seo_text', - ], - ]) ?> + ] + ) ?> diff --git a/backend/views/seo/index.php b/backend/views/seo/index.php index 4269597..d88cac6 100755 --- a/backend/views/seo/index.php +++ b/backend/views/seo/index.php @@ -18,34 +18,36 @@= Html::a(Yii::t('app', 'Create Seo'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - [ 'class' => 'yii\grid\SerialColumn' ], - 'seo_id', - 'url', - [ - 'attribute' => 'title', - 'value' => 'lang.title', + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + 'id', + 'url', + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + [ + 'attribute' => 'meta_description', + 'value' => 'lang.meta_description', + ], + [ + 'attribute' => 'h1', + 'value' => 'lang.h1', + ], + [ + 'attribute' => 'meta', + 'value' => 'lang.meta', + ], + [ + 'attribute' => 'seo_text', + 'value' => 'lang.seo_text', + ], + [ 'class' => 'yii\grid\ActionColumn' ], ], - [ - 'attribute' => 'meta_description', - 'value' => 'lang.meta_description', - ], - [ - 'attribute' => 'h1', - 'value' => 'lang.h1', - ], - [ - 'attribute' => 'meta', - 'value' => 'lang.meta', - ], - [ - 'attribute' => 'seo_text', - 'value' => 'lang.seo_text', - ], - [ 'class' => 'yii\grid\ActionColumn' ], - ], - ]); ?> + ] + ); ?> diff --git a/backend/views/seo/update.php b/backend/views/seo/update.php index 965d036..62d22d4 100755 --- a/backend/views/seo/update.php +++ b/backend/views/seo/update.php @@ -11,9 +11,13 @@ * @var SeoLang[] $modelLangs */ - $this->title = Yii::t('app', 'Update {modelClass}: ', [ - 'modelClass' => 'Seo', - ]) . $model->url; + $this->title = Yii::t( + 'app', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Seo', + ] + ) . $model->url; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Seos'), 'url' => [ 'index' ], @@ -22,7 +26,7 @@ 'label' => $model->url, 'url' => [ 'view', - 'id' => $model->seo_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); @@ -31,9 +35,12 @@- = Html::a(Yii::t('app', 'Update'), [ - 'update', - 'id' => $model->seo_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - = Html::a(Yii::t('app', 'Delete'), [ - 'delete', - 'id' => $model->seo_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + = Html::a( + Yii::t('app', 'Update'), + [ + 'update', + 'id' => $model->id, ], - ]) ?> + [ 'class' => 'btn btn-primary' ] + ) ?> + = Html::a( + Yii::t('app', 'Delete'), + [ + 'delete', + 'id' => $model->id, + ], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?>
- = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'seo_id', - 'url', - 'lang.title', - 'lang.meta_description', - 'lang.h1', - 'lang.meta', - 'lang.seo_text', - ], - ]) ?> + = DetailView::widget( + [ + 'model' => $model, + 'attributes' => [ + 'id', + 'url', + 'lang.title', + 'lang.meta_description', + 'lang.h1', + 'lang.meta', + 'lang.seo_text', + ], + ] + ) ?> diff --git a/backend/views/service/index.php b/backend/views/service/index.php index 6d37430..61132b6 100755 --- a/backend/views/service/index.php +++ b/backend/views/service/index.php @@ -18,17 +18,19 @@= Html::a(Yii::t('app', 'Create Service'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - [ 'class' => 'yii\grid\SerialColumn' ], - - 'service_id', - 'imageUrl:image', - 'created_at:date', - - [ 'class' => 'yii\grid\ActionColumn' ], - ], - ]); ?> + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + [ 'class' => 'yii\grid\SerialColumn' ], + + 'id', + 'imageUrl:image', + 'created_at:date', + + [ 'class' => 'yii\grid\ActionColumn' ], + ], + ] + ); ?> diff --git a/backend/views/service/update.php b/backend/views/service/update.php index 7dea7db..f5763bc 100755 --- a/backend/views/service/update.php +++ b/backend/views/service/update.php @@ -11,18 +11,22 @@ * @var ServiceLang[] $modelLangs */ - $this->title = Yii::t('app', 'Update {modelClass}: ', [ - 'modelClass' => 'Service', - ]) . $model->service_id; + $this->title = Yii::t( + 'app', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Service', + ] + ) . $model->id; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Services'), 'url' => [ 'index' ], ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => $model->service_id, + 'label' => $model->id, 'url' => [ 'view', - 'id' => $model->service_id, + 'id' => $model->id, ], ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); @@ -31,9 +35,12 @@- = Html::a(Yii::t('app', 'Update'), [ - 'update', - 'id' => $model->service_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - = Html::a(Yii::t('app', 'Delete'), [ - 'delete', - 'id' => $model->service_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + = Html::a( + Yii::t('app', 'Update'), + [ + 'update', + 'id' => $model->id, ], - ]) ?> + [ 'class' => 'btn btn-primary' ] + ) ?> + = Html::a( + Yii::t('app', 'Delete'), + [ + 'delete', + 'id' => $model->id, + ], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?>
- = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'service_id', - 'imageUrl:image', - 'created_at:date', - ], - ]) ?> + = DetailView::widget( + [ + 'model' => $model, + 'attributes' => [ + 'id', + 'imageUrl:image', + 'created_at:date', + ], + ] + ) ?> diff --git a/backend/views/slider-image/index.php b/backend/views/slider-image/index.php index cbe1ee0..41b5c2f 100755 --- a/backend/views/slider-image/index.php +++ b/backend/views/slider-image/index.php @@ -23,66 +23,92 @@- = Html::a(Yii::t('app', 'Create Slider Image'), Url::toRoute([ - 'create', - 'slider_id' => $slider_id, - ]), [ 'class' => 'btn btn-success' ]) ?> + = Html::a( + Yii::t('app', 'Create Slider Image'), + Url::toRoute( + [ + 'create', + 'slider_id' => $slider_id, + ] + ), + [ 'class' => 'btn btn-success' ] + ) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - 'slider_image_id', - 'imageUrl:image', - 'url', - [ - 'attribute' => 'status', - 'value' => function($model) { - /** - * @var SliderImage $model - */ - return ( !$model->status ) ? \Yii::t('app', 'Скрыто') : \Yii::t('app', 'Показать'); - }, - 'filter' => [ - 0 => \Yii::t('app', 'Скрыто'), - 1 => \Yii::t('app', 'Показать'), - ], - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'buttons' => [ - 'view' => function($url, $model) { - return Html::a('', Url::toRoute([ - 'view', - 'slider_id' => $model->slider_id, - 'id' => $model->slider_image_id, - ]), [ - 'title' => \Yii::t('app', 'Просмотр'), - ]); - }, - 'update' => function($url, $model) { - return Html::a('', Url::toRoute([ - 'update', - 'slider_id' => $model->slider_id, - 'id' => $model->slider_image_id, - ]), [ - 'title' => \Yii::t('app', 'Редактировать'), - ]); - }, - 'delete' => function($url, $model) { - return Html::a('', Url::toRoute([ - 'delete', - 'slider_id' => $model->slider_id, - 'id' => $model->slider_image_id, - ]), [ - 'title' => Yii::t('yii', 'Delete'), - 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), - 'data-method' => 'post', - ]); - + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + 'imageUrl:image', + 'url', + [ + 'attribute' => 'status', + 'value' => function ($model) { + /** + * @var SliderImage $model + */ + return ( !$model->status ) ? \Yii::t('app', 'Скрыто') : \Yii::t('app', 'Показать'); }, + 'filter' => [ + 0 => \Yii::t('app', 'Скрыто'), + 1 => \Yii::t('app', 'Показать'), + ], + ], + [ + 'class' => 'yii\grid\ActionColumn', + 'buttons' => [ + 'view' => function ($url, $model) { + return Html::a( + '', + Url::toRoute( + [ + 'view', + 'slider_id' => $model->slider_id, + 'id' => $model->id, + ] + ), + [ + 'title' => \Yii::t('app', 'Просмотр'), + ] + ); + }, + 'update' => function ($url, $model) { + return Html::a( + '', + Url::toRoute( + [ + 'update', + 'slider_id' => $model->slider_id, + 'id' => $model->id, + ] + ), + [ + 'title' => \Yii::t('app', 'Редактировать'), + ] + ); + }, + 'delete' => function ($url, $model) { + return Html::a( + '', + Url::toRoute( + [ + 'delete', + 'slider_id' => $model->slider_id, + 'id' => $model->id, + ] + ), + [ + 'title' => Yii::t('yii', 'Delete'), + 'data-confirm' => Yii::t('yii', 'Are you sure to delete this item?'), + 'data-method' => 'post', + ] + ); + + }, + ], ], ], - ], - ]); ?> + ] + ); ?> diff --git a/backend/views/slider-image/update.php b/backend/views/slider-image/update.php index a17b813..96a3fe2 100755 --- a/backend/views/slider-image/update.php +++ b/backend/views/slider-image/update.php @@ -15,29 +15,39 @@ * @var int $slider_id */ - $this->title = Yii::t('app', 'Update {modelClass}: ', [ - 'modelClass' => 'Slider Image', - ]) . $model->slider_image_id; + $this->title = Yii::t( + 'app', + 'Update {modelClass}: ', + [ + 'modelClass' => 'Slider Image', + ] + ) . $model->id; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Sliders'), - 'url' => Url::toRoute([ - 'slider/index', - ]), + 'url' => Url::toRoute( + [ + 'slider/index', + ] + ), ]; $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('app', 'Slider Images'), - 'url' => Url::toRoute([ - 'index', - 'slider_id' => $slider_id, - ]), + 'url' => Url::toRoute( + [ + 'index', + 'slider_id' => $slider_id, + ] + ), ]; $this->params[ 'breadcrumbs' ][] = [ - 'label' => \Yii::t('app', 'Slide').': '.$model->slider_image_id, - 'url' => Url::toRoute([ - 'view', - 'slider_id' => $slider_id, - 'id' => $model->slider_image_id, - ]), + 'label' => \Yii::t('app', 'Slide') . ': ' . $model->id, + 'url' => Url::toRoute( + [ + 'view', + 'slider_id' => $slider_id, + 'id' => $model->id, + ] + ), ]; $this->params[ 'breadcrumbs' ][] = Yii::t('app', 'Update'); ?> @@ -45,10 +55,13 @@- = Html::a(Yii::t('app', 'Update'), [ - 'update', - 'slider_id' => $slider_id, - 'id' => $model->slider_image_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - = Html::a(Yii::t('app', 'Delete'), [ - 'delete', - 'slider_id' => $slider_id, - 'id' => $model->slider_image_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), - 'method' => 'post', + = Html::a( + Yii::t('app', 'Update'), + [ + 'update', + 'slider_id' => $slider_id, + 'id' => $model->id, ], - ]) ?> -
- - = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'slider_image_id', + [ 'class' => 'btn btn-primary' ] + ) ?> + = Html::a( + Yii::t('app', 'Delete'), [ - 'attribute' => 'slider_id', - 'format' => 'html', - 'value' => Html::a($model->slider->title, [ - 'slider/update', - 'id' => $model->slider_id, - ]), + 'delete', + 'slider_id' => $slider_id, + 'id' => $model->id, ], - 'lang.title', - 'lang.alt', - 'imageUrl:image', - 'url:url', [ - 'attribute' => 'status', - 'value' => $model->status?\Yii::t('app', 'Показать'):\Yii::t('app', 'Скрыть'), + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?> + + + = DetailView::widget( + [ + 'model' => $model, + 'attributes' => [ + 'id', + [ + 'attribute' => 'slider_id', + 'format' => 'html', + 'value' => Html::a( + $model->slider->title, + [ + 'slider/update', + 'id' => $model->slider_id, + ] + ), + ], + 'lang.title', + 'lang.alt', + 'imageUrl:image', + 'url:url', + [ + 'attribute' => 'status', + 'value' => $model->status ? \Yii::t('app', 'Показать') : \Yii::t('app', 'Скрыть'), + ], + 'sort', ], - 'sort', - ], - ]) ?> + ] + ) ?> diff --git a/backend/views/slider/index.php b/backend/views/slider/index.php index e80f89e..c5596d4 100755 --- a/backend/views/slider/index.php +++ b/backend/views/slider/index.php @@ -20,48 +20,56 @@= Html::a(Yii::t('app', 'Create Slider'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - 'slider_id', - 'title', - [ - 'attribute' => 'status', - 'value' => function($model) { - /** - * @var Slider $model - */ - return ( !$model->status ) ? \Yii::t('app', 'Скрыто') : \Yii::t('app', 'Показать'); - }, - 'filter' => [ - 0 => \Yii::t('app', 'Скрыто'), - 1 => \Yii::t('app', 'Показать'), + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + 'title', + [ + 'attribute' => 'status', + 'value' => function ($model) { + /** + * @var Slider $model + */ + return ( !$model->status ) ? \Yii::t('app', 'Скрыто') : \Yii::t('app', 'Показать'); + }, + 'filter' => [ + 0 => \Yii::t('app', 'Скрыто'), + 1 => \Yii::t('app', 'Показать'), + ], ], - ], - [ - 'label' => \Yii::t('app', 'Slide count'), - 'content' => function($model) { - /** - * @var Slider $model - */ + [ + 'label' => \Yii::t('app', 'Slide count'), + 'content' => function ($model) { + /** + * @var Slider $model + */ return count($model->sliderImage); - }, - ], - [ - 'class' => 'yii\grid\ActionColumn', - 'template' => '{update} {image} {delete}', - 'buttons' => [ - 'image' => function($url, $model) { - return Html::a('', Url::toRoute([ - 'slider-image/index', - 'slider_id' => $model->slider_id, - ]), [ - 'title' => \Yii::t('app', "слайды"), - ]); }, ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' => '{update} {image} {delete}', + 'buttons' => [ + 'image' => function ($url, $model) { + return Html::a( + '', + Url::toRoute( + [ + 'slider-image/index', + 'slider_id' => $model->id, + ] + ), + [ + 'title' => \Yii::t('app', "слайды"), + ] + ); + }, + ], + ], ], - ], - ]); ?> + ] + ); ?> diff --git a/common/models/Basket.php b/common/models/Basket.php index 9ffc7bd..de348be 100755 --- a/common/models/Basket.php +++ b/common/models/Basket.php @@ -93,7 +93,7 @@ * @var ProductVariant $model */ $model = ProductVariant::find() - ->where([ 'product_variant.product_variant_id' => $product_variant_id ]) + ->where([ 'product_variant.id' => $product_variant_id ]) ->joinWith('lang', true, 'INNER JOIN') ->one(); if(empty( $model )) { @@ -106,7 +106,7 @@ public function findModels(array $product_variant_ids) { return ProductVariant::find() - ->where([ 'product_variant.product_variant_id' => $product_variant_ids ]) + ->where([ 'product_variant.id' => $product_variant_ids ]) ->joinWith('lang', true, 'INNER JOIN') ->with([ 'product', diff --git a/common/models/Order.php b/common/models/Order.php index d7668f7..7e13337 100755 --- a/common/models/Order.php +++ b/common/models/Order.php @@ -217,7 +217,7 @@ 'product.alias', ] ) - ->where([ 'product_variant.product_variant_id' => $product[ 'id' ] ]) + ->where([ 'product_variant.id' => $product[ 'id' ] ]) ->leftJoin('product', 'product.id = product_variant.product_id') ->one(); $row->count = $product[ 'count' ]; @@ -249,7 +249,7 @@ * @var ProductVariant $mod */ $mod = ProductVariant::find() - ->where([ 'product_variant_id' => $product_variant_id ]) + ->where([ 'id' => $product_variant_id ]) ->one(); return $mod->price; diff --git a/common/models/OrderProduct.php b/common/models/OrderProduct.php index a3e09de..6f61e86 100755 --- a/common/models/OrderProduct.php +++ b/common/models/OrderProduct.php @@ -51,6 +51,6 @@ public function getProductVariant() { - return $this->hasOne(ProductVariant::className(), [ 'product_variant_id' => 'product_variant_id' ]); + return $this->hasOne(ProductVariant::className(), [ 'id' => 'product_variant_id' ]); } } \ No newline at end of file diff --git a/common/models/Seo.php b/common/models/Seo.php index 4d7d25f..3a6bf52 100755 --- a/common/models/Seo.php +++ b/common/models/Seo.php @@ -10,7 +10,8 @@ /** * This is the model class for table "seo". - * @property integer $seo_id + * + * @property integer $id * @property string $url * * From language behavior * * @property SeoLang $lang @@ -77,8 +78,8 @@ public function attributeLabels() { return [ - 'seo_id' => Yii::t('app', 'seo_id'), - 'url' => Yii::t('app', 'url'), + 'id' => Yii::t('app', 'seo_id'), + 'url' => Yii::t('app', 'url'), ]; } } diff --git a/common/models/SeoCategory.php b/common/models/SeoCategory.php index 7467905..bbdd697 100755 --- a/common/models/SeoCategory.php +++ b/common/models/SeoCategory.php @@ -10,7 +10,8 @@ /** * This is the model class for table "seo_category". - * @property integer $seo_category_id + * + * @property integer $id * @property string $controller * @property integer $status * * From language behavior * @@ -79,9 +80,9 @@ public function attributeLabels() { return [ - 'seo_category_id' => Yii::t('app', 'seo_category_id'), - 'controller' => Yii::t('app', 'controller'), - 'status' => Yii::t('app', 'status'), + 'id' => Yii::t('app', 'seo_category_id'), + 'controller' => Yii::t('app', 'controller'), + 'status' => Yii::t('app', 'status'), ]; } @@ -90,6 +91,6 @@ */ public function getSeoDynamics() { - return $this->hasMany(SeoDynamic::className(), [ 'seo_category_id' => 'seo_category_id' ]); + return $this->hasMany(SeoDynamic::className(), [ 'seo_category_id' => 'id' ]); } } diff --git a/common/models/SeoCategoryLang.php b/common/models/SeoCategoryLang.php index d78bcbc..e318718 100755 --- a/common/models/SeoCategoryLang.php +++ b/common/models/SeoCategoryLang.php @@ -8,6 +8,7 @@ /** * This is the model class for table "seo_category_lang". + * * @property integer $seo_category_id * @property integer $language_id * @property string $title @@ -68,7 +69,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), - 'targetAttribute' => [ 'seo_category_id' => 'seo_category_id' ], + 'targetAttribute' => [ 'seo_category_id' => 'id' ], ], ]; } @@ -81,7 +82,7 @@ return [ 'seo_category_id' => Yii::t('app', 'seo_category_id'), 'language_id' => Yii::t('app', 'language_id'), - 'title' => Yii::t('app', 'name'), + 'title' => Yii::t('app', 'name'), ]; } @@ -98,6 +99,6 @@ */ public function getSeoCategory() { - return $this->hasOne(SeoCategory::className(), [ 'seo_category_id' => 'seo_category_id' ]); + return $this->hasOne(SeoCategory::className(), [ 'id' => 'seo_category_id' ]); } } diff --git a/common/models/SeoCategorySearch.php b/common/models/SeoCategorySearch.php index 57665cd..e10e1a8 100755 --- a/common/models/SeoCategorySearch.php +++ b/common/models/SeoCategorySearch.php @@ -27,7 +27,7 @@ return [ [ [ - 'seo_category_id', + 'id', 'status', ], 'integer', @@ -65,45 +65,53 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'seo_category_id', - 'controller', - 'status', - 'title' => [ - 'asc' => [ 'seo_category_lang.title' => SORT_ASC ], - 'desc' => [ 'seo_category_lang.title' => SORT_DESC ], + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'controller', + 'status', + 'title' => [ + 'asc' => [ 'seo_category_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_category_lang.title' => SORT_DESC ], + ], ], ], - ], - ]); + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andFilterWhere([ - 'seo_category_id' => $this->seo_category_id, - 'status' => $this->status, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + 'status' => $this->status, + ] + ); - $query->andFilterWhere([ - 'like', - 'controller', - $this->controller, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_category_lang.title', - $this->title, - ]); + $query->andFilterWhere( + [ + 'like', + 'controller', + $this->controller, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_category_lang.title', + $this->title, + ] + ); return $dataProvider; } diff --git a/common/models/SeoDynamic.php b/common/models/SeoDynamic.php index bb62365..456db25 100755 --- a/common/models/SeoDynamic.php +++ b/common/models/SeoDynamic.php @@ -10,7 +10,8 @@ /** * This is the model class for table "seo_dynamic". - * @property integer $seo_dynamic_id + * + * @property integer $id * @property integer $seo_category_id * @property string $action * @property string $fields @@ -91,7 +92,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => SeoCategory::className(), - 'targetAttribute' => [ 'seo_category_id' => 'seo_category_id' ], + 'targetAttribute' => [ 'seo_category_id' => 'id' ], ], ]; } @@ -102,7 +103,7 @@ public function attributeLabels() { return [ - 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), + 'id' => Yii::t('app', 'seo_dynamic_id'), 'seo_category_id' => Yii::t('app', 'seo_category_id'), 'action' => Yii::t('app', 'action'), 'fields' => Yii::t('app', 'fields'), @@ -116,6 +117,6 @@ */ public function getSeoCategory() { - return $this->hasOne(SeoCategory::className(), [ 'seo_category_id' => 'seo_category_id' ]); + return $this->hasOne(SeoCategory::className(), [ 'id' => 'seo_category_id' ]); } } diff --git a/common/models/SeoDynamicLang.php b/common/models/SeoDynamicLang.php index 6678570..555c713 100755 --- a/common/models/SeoDynamicLang.php +++ b/common/models/SeoDynamicLang.php @@ -8,6 +8,7 @@ /** * This is the model class for table "seo_dynamic_lang". + * * @property integer $seo_dynamic_id * @property integer $language_id * @property string $title @@ -87,7 +88,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => SeoDynamic::className(), - 'targetAttribute' => [ 'seo_dynamic_id' => 'seo_dynamic_id' ], + 'targetAttribute' => [ 'seo_dynamic_id' => 'id' ], ], ]; } @@ -98,15 +99,15 @@ public function attributeLabels() { return [ - 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), - 'language_id' => Yii::t('app', 'language_id'), - 'title' => Yii::t('app', 'name'), - 'meta_title' => Yii::t('app', 'title'), - 'h1' => Yii::t('app', 'h1'), - 'key' => Yii::t('app', 'key'), - 'meta' => Yii::t('app', 'meta'), - 'meta_description' => Yii::t('app', 'meta_description'), - 'seo_text' => Yii::t('app', 'seo_text'), + 'seo_dynamic_id' => Yii::t('app', 'seo_dynamic_id'), + 'language_id' => Yii::t('app', 'language_id'), + 'title' => Yii::t('app', 'name'), + 'meta_title' => Yii::t('app', 'title'), + 'h1' => Yii::t('app', 'h1'), + 'key' => Yii::t('app', 'key'), + 'meta' => Yii::t('app', 'meta'), + 'meta_description' => Yii::t('app', 'meta_description'), + 'seo_text' => Yii::t('app', 'seo_text'), ]; } @@ -123,6 +124,6 @@ */ public function getSeoDynamic() { - return $this->hasOne(SeoDynamic::className(), [ 'seo_dynamic_id' => 'seo_dynamic_id' ]); + return $this->hasOne(SeoDynamic::className(), [ 'id' => 'seo_dynamic_id' ]); } } diff --git a/common/models/SeoDynamicSearch.php b/common/models/SeoDynamicSearch.php index d592d88..caa2505 100755 --- a/common/models/SeoDynamicSearch.php +++ b/common/models/SeoDynamicSearch.php @@ -27,7 +27,7 @@ return [ [ [ - 'seo_dynamic_id', + 'id', 'status', ], 'integer', @@ -68,60 +68,74 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'seo_dynamic_id', - 'action', - 'fields', - 'status', - 'param', - 'title' => [ - 'asc' => [ 'seo_dynamic_lang.title' => SORT_ASC ], - 'desc' => [ 'seo_dynamic_lang.title' => SORT_DESC ], + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'action', + 'fields', + 'status', + 'param', + 'title' => [ + 'asc' => [ 'seo_dynamic_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_dynamic_lang.title' => SORT_DESC ], + ], ], ], - ], - ]); + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andWhere([ - 'seo_category_id' => $seo_category_id, - ]) - ->andFilterWhere([ - 'seo_dynamic_id' => $this->seo_dynamic_id, - 'status' => $this->status, - ]); + $query->andWhere( + [ + 'seo_category_id' => $seo_category_id, + ] + ) + ->andFilterWhere( + [ + 'id' => $this->id, + 'status' => $this->status, + ] + ); - $query->andFilterWhere([ - 'ilike', - 'action', - $this->action, - ]) - ->andFilterWhere([ - 'ilike', - 'fields', - $this->fields, - ]) - ->andFilterWhere([ - 'ilike', - 'param', - $this->param, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_dynamic_lang.title', - $this->title, - ]); + $query->andFilterWhere( + [ + 'ilike', + 'action', + $this->action, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'fields', + $this->fields, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'param', + $this->param, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_dynamic_lang.title', + $this->title, + ] + ); return $dataProvider; } diff --git a/common/models/SeoLang.php b/common/models/SeoLang.php index e0b8bde..c6da2f5 100755 --- a/common/models/SeoLang.php +++ b/common/models/SeoLang.php @@ -8,6 +8,7 @@ /** * This is the model class for table "seo_lang". + * * @property integer $seo_id * @property integer $language_id * @property string $title @@ -83,7 +84,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Seo::className(), - 'targetAttribute' => [ 'seo_id' => 'seo_id' ], + 'targetAttribute' => [ 'seo_id' => 'id' ], ], ]; } @@ -94,13 +95,13 @@ public function attributeLabels() { return [ - 'seo_id' => Yii::t('app', 'seo_id'), - 'language_id' => Yii::t('app', 'language_id'), - 'title' => Yii::t('app', 'title'), + 'seo_id' => Yii::t('app', 'seo_id'), + 'language_id' => Yii::t('app', 'language_id'), + 'title' => Yii::t('app', 'title'), 'meta_description' => Yii::t('app', 'meta_description'), - 'h1' => Yii::t('app', 'h1'), - 'meta' => Yii::t('app', 'meta'), - 'seo_text' => Yii::t('app', 'seo_text'), + 'h1' => Yii::t('app', 'h1'), + 'meta' => Yii::t('app', 'meta'), + 'seo_text' => Yii::t('app', 'seo_text'), ]; } @@ -117,6 +118,6 @@ */ public function getSeo() { - return $this->hasOne(Seo::className(), [ 'seo_id' => 'seo_id' ]); + return $this->hasOne(Seo::className(), [ 'id' => 'seo_id' ]); } } diff --git a/common/models/SeoSearch.php b/common/models/SeoSearch.php index d73e065..28961f0 100755 --- a/common/models/SeoSearch.php +++ b/common/models/SeoSearch.php @@ -33,7 +33,7 @@ { return [ [ - [ 'seo_id' ], + [ 'id' ], 'integer', ], [ @@ -73,79 +73,95 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - 'sort' => [ - 'attributes' => [ - 'seo_id', - 'url', - 'title' => [ - 'asc' => [ 'seo_lang.title' => SORT_ASC ], - 'desc' => [ 'seo_lang.title' => SORT_DESC ], - ], - 'meta_description' => [ - 'asc' => [ 'seo_lang.meta_description' => SORT_ASC ], - 'desc' => [ 'seo_lang.meta_description' => SORT_DESC ], - ], - 'h1' => [ - 'asc' => [ 'seo_lang.h1' => SORT_ASC ], - 'desc' => [ 'seo_lang.h1' => SORT_DESC ], - ], - 'meta' => [ - 'asc' => [ 'seo_lang.meta' => SORT_ASC ], - 'desc' => [ 'seo_lang.meta' => SORT_DESC ], - ], - 'seo_text' => [ - 'asc' => [ 'seo_lang.seo_text' => SORT_ASC ], - 'desc' => [ 'seo_lang.seo_text' => SORT_DESC ], + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + 'sort' => [ + 'attributes' => [ + 'id', + 'url', + 'title' => [ + 'asc' => [ 'seo_lang.title' => SORT_ASC ], + 'desc' => [ 'seo_lang.title' => SORT_DESC ], + ], + 'meta_description' => [ + 'asc' => [ 'seo_lang.meta_description' => SORT_ASC ], + 'desc' => [ 'seo_lang.meta_description' => SORT_DESC ], + ], + 'h1' => [ + 'asc' => [ 'seo_lang.h1' => SORT_ASC ], + 'desc' => [ 'seo_lang.h1' => SORT_DESC ], + ], + 'meta' => [ + 'asc' => [ 'seo_lang.meta' => SORT_ASC ], + 'desc' => [ 'seo_lang.meta' => SORT_DESC ], + ], + 'seo_text' => [ + 'asc' => [ 'seo_lang.seo_text' => SORT_ASC ], + 'desc' => [ 'seo_lang.seo_text' => SORT_DESC ], + ], ], ], - ], - ]); + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andFilterWhere([ - 'seo_id' => $this->seo_id, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + ] + ); - $query->andFilterWhere([ - 'like', - 'url', - $this->url, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_lang.title', - $this->title, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_lang.meta_description', - $this->meta_description, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_lang.h1', - $this->h1, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_lang.meta', - $this->meta, - ]) - ->andFilterWhere([ - 'ilike', - 'seo_lang.seo_text', - $this->seoText, - ]); + $query->andFilterWhere( + [ + 'like', + 'url', + $this->url, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_lang.title', + $this->title, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_lang.meta_description', + $this->meta_description, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_lang.h1', + $this->h1, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_lang.meta', + $this->meta, + ] + ) + ->andFilterWhere( + [ + 'ilike', + 'seo_lang.seo_text', + $this->seoText, + ] + ); return $dataProvider; } diff --git a/common/models/Service.php b/common/models/Service.php index 30c2ed9..96d2cd3 100755 --- a/common/models/Service.php +++ b/common/models/Service.php @@ -12,7 +12,8 @@ /** * This is the model class for table "service". - * @property integer $service_id + * + * @property integer $id * @property string $image * @property integer $created_at * @property integer $updated_at @@ -98,7 +99,7 @@ public function attributeLabels() { return [ - 'service_id' => Yii::t('app', 'service_id'), + 'id' => Yii::t('app', 'service_id'), 'image' => Yii::t('app', 'image'), 'created_at' => Yii::t('app', 'created_at'), 'updated_at' => Yii::t('app', 'updated_at'), diff --git a/common/models/ServiceLang.php b/common/models/ServiceLang.php index 42dcc78..db024a1 100755 --- a/common/models/ServiceLang.php +++ b/common/models/ServiceLang.php @@ -8,6 +8,7 @@ /** * This is the model class for table "service_lang". + * * @property integer $service_id * @property integer $language_id * @property string $title @@ -42,7 +43,7 @@ { return [ 'slug' => [ - 'class' => 'common\behaviors\Slug', + 'class' => 'common\behaviors\Slug', ], ]; } @@ -101,7 +102,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Service::className(), - 'targetAttribute' => [ 'service_id' => 'service_id' ], + 'targetAttribute' => [ 'service_id' => 'id' ], ], ]; } @@ -112,14 +113,14 @@ public function attributeLabels() { return [ - 'service_id' => Yii::t('app', 'service_id'), - 'language_id' => Yii::t('app', 'language_id'), - 'title' => Yii::t('app', 'name'), - 'body' => Yii::t('app', 'body'), - 'seo_text' => Yii::t('app', 'seo_text'), - 'meta_title' => Yii::t('app', 'meta_title'), + 'service_id' => Yii::t('app', 'service_id'), + 'language_id' => Yii::t('app', 'language_id'), + 'title' => Yii::t('app', 'name'), + 'body' => Yii::t('app', 'body'), + 'seo_text' => Yii::t('app', 'seo_text'), + 'meta_title' => Yii::t('app', 'meta_title'), 'meta_description' => Yii::t('app', 'meta_description'), - 'h1' => Yii::t('app', 'h1'), + 'h1' => Yii::t('app', 'h1'), ]; } @@ -136,6 +137,6 @@ */ public function getService() { - return $this->hasOne(Service::className(), [ 'service_id' => 'service_id' ]); + return $this->hasOne(Service::className(), [ 'id' => 'service_id' ]); } } diff --git a/common/models/ServiceSearch.php b/common/models/ServiceSearch.php index e4ca391..1561e72 100755 --- a/common/models/ServiceSearch.php +++ b/common/models/ServiceSearch.php @@ -24,7 +24,7 @@ return [ [ [ - 'service_id', + 'id', 'created_at', 'updated_at', ], @@ -55,24 +55,28 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - ]); + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andFilterWhere([ - 'service_id' => $this->service_id, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ] + ); return $dataProvider; } diff --git a/common/models/Slider.php b/common/models/Slider.php index 52eacbe..fc2cd5d 100755 --- a/common/models/Slider.php +++ b/common/models/Slider.php @@ -7,13 +7,14 @@ /** * This is the model class for table "slider". - * @property integer $slider_id - * @property integer $speed - * @property integer $duration - * @property string $title - * @property integer $status - * @property integer $width - * @property integer $height + * + * @property integer $id + * @property integer $speed + * @property integer $duration + * @property string $title + * @property integer $status + * @property integer $width + * @property integer $height * @property SliderImage[] $sliderImage */ class Slider extends ActiveRecord @@ -60,9 +61,13 @@ 'title', 'unique', 'targetClass' => '\common\models\Slider', - 'message' => Yii::t('app', 'message', [ - 'field' => 'Title', - ]), + 'message' => Yii::t( + 'app', + 'message', + [ + 'field' => 'Title', + ] + ), ], ]; } @@ -73,13 +78,13 @@ public function attributeLabels() { return [ - 'slider_id' => Yii::t('app', 'slider_id'), - 'speed' => Yii::t('app', 'speed'), - 'duration' => Yii::t('app', 'duration'), - 'title' => Yii::t('app', 'title'), - 'status' => Yii::t('app', 'status'), - 'width' => Yii::t('app', 'width'), - 'height' => Yii::t('app', 'height'), + 'id' => Yii::t('app', 'slider_id'), + 'speed' => Yii::t('app', 'speed'), + 'duration' => Yii::t('app', 'duration'), + 'title' => Yii::t('app', 'title'), + 'status' => Yii::t('app', 'status'), + 'width' => Yii::t('app', 'width'), + 'height' => Yii::t('app', 'height'), ]; } @@ -88,7 +93,7 @@ */ public function getSliderImage() { - return $this->hasMany(SliderImage::className(), [ 'slider_id' => 'slider_id' ]) + return $this->hasMany(SliderImage::className(), [ 'slider_id' => 'id' ]) ->where([ SliderImage::tableName() . '.status' => 1 ]); } diff --git a/common/models/SliderImage.php b/common/models/SliderImage.php index d20ae98..a7bff7e 100755 --- a/common/models/SliderImage.php +++ b/common/models/SliderImage.php @@ -11,7 +11,8 @@ /** * This is the model class for table "slider_image". - * @property integer $slider_image_id + * + * @property integer $id * @property integer $slider_id * @property string $image * @property string $url @@ -82,7 +83,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => Slider::className(), - 'targetAttribute' => [ 'slider_id' => 'slider_id' ], + 'targetAttribute' => [ 'slider_id' => 'id' ], ], ]; } @@ -111,12 +112,12 @@ public function attributeLabels() { return [ - 'slider_image_id' => Yii::t('app', 'slider_image_id'), - 'slider_id' => Yii::t('app', 'slider_id'), - 'image' => Yii::t('app', 'image'), - 'url' => Yii::t('app', 'url'), - 'status' => Yii::t('app', 'status'), - 'sort' => Yii::t('app', 'sort'), + 'id' => Yii::t('app', 'slider_image_id'), + 'slider_id' => Yii::t('app', 'slider_id'), + 'image' => Yii::t('app', 'image'), + 'url' => Yii::t('app', 'url'), + 'status' => Yii::t('app', 'status'), + 'sort' => Yii::t('app', 'sort'), ]; } @@ -125,7 +126,7 @@ */ public function getSlider() { - return $this->hasOne(Slider::className(), [ 'slider_id' => 'slider_id' ]); + return $this->hasOne(Slider::className(), [ 'id' => 'slider_id' ]); } } diff --git a/common/models/SliderImageLang.php b/common/models/SliderImageLang.php index 3673edf..20d3397 100755 --- a/common/models/SliderImageLang.php +++ b/common/models/SliderImageLang.php @@ -8,6 +8,7 @@ /** * This is the model class for table "slider_image_lang". + * * @property integer $slider_image_id * @property integer $language_id * @property string $title @@ -72,7 +73,7 @@ 'exist', 'skipOnError' => true, 'targetClass' => SliderImage::className(), - 'targetAttribute' => [ 'slider_image_id' => 'slider_image_id' ], + 'targetAttribute' => [ 'slider_image_id' => 'id' ], ], ]; } @@ -103,6 +104,6 @@ */ public function getSliderImage() { - return $this->hasOne(SliderImage::className(), [ 'slider_image_id' => 'slider_image_id' ]); + return $this->hasOne(SliderImage::className(), [ 'id' => 'slider_image_id' ]); } } diff --git a/common/models/SliderImageSearch.php b/common/models/SliderImageSearch.php index 19f777f..7a7ca9e 100755 --- a/common/models/SliderImageSearch.php +++ b/common/models/SliderImageSearch.php @@ -25,7 +25,7 @@ return [ [ [ - 'slider_image_id', + 'id', 'slider_id', 'status', 'sort', @@ -64,31 +64,37 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - ]); + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andFilterWhere([ - 'slider_image_id' => $this->slider_image_id, - 'slider_id' => $slider_id, - 'status' => $this->status, - 'sort' => $this->sort, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + 'slider_id' => $slider_id, + 'status' => $this->status, + 'sort' => $this->sort, + ] + ); - $query->andFilterWhere([ - 'like', - 'url', - $this->url, - ]); + $query->andFilterWhere( + [ + 'like', + 'url', + $this->url, + ] + ); return $dataProvider; } diff --git a/common/models/SliderSearch.php b/common/models/SliderSearch.php index 180796b..77a4630 100755 --- a/common/models/SliderSearch.php +++ b/common/models/SliderSearch.php @@ -21,7 +21,7 @@ return [ [ [ - 'slider_id', + 'id', 'status', ], 'integer', @@ -55,29 +55,35 @@ // add conditions that should always apply here - $dataProvider = new ActiveDataProvider([ - 'query' => $query, - ]); + $dataProvider = new ActiveDataProvider( + [ + 'query' => $query, + ] + ); $this->load($params); - if(!$this->validate()) { + if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // grid filtering conditions - $query->andFilterWhere([ - 'slider_id' => $this->slider_id, - 'status' => $this->status, - ]); + $query->andFilterWhere( + [ + 'id' => $this->id, + 'status' => $this->status, + ] + ); - $query->andFilterWhere([ - 'like', - 'title', - $this->title, - ]); + $query->andFilterWhere( + [ + 'like', + 'title', + $this->title, + ] + ); return $dataProvider; } diff --git a/common/modules/product/controllers/ManageController.php b/common/modules/product/controllers/ManageController.php index 3c5e55f..ec2b985 100755 --- a/common/modules/product/controllers/ManageController.php +++ b/common/modules/product/controllers/ManageController.php @@ -39,6 +39,7 @@ /** * Lists all Product models. + * * @return mixed */ public function actionIndex() @@ -46,10 +47,13 @@ $searchModel = new ProductSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } /** @@ -69,17 +73,21 @@ ->with('lang') ->all(); $properties = $model->getProperties(); - return $this->render('view', [ - 'model' => $this->findModel($id), - 'categories' => $categories, - 'variants' => $variants, - 'properties' => $properties, - ]); + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + 'categories' => $categories, + 'variants' => $variants, + 'properties' => $properties, + ] + ); } /** * Creates a new Product model. * If creation is successful, the browser will be redirected to the 'view' page. + * * @return mixed */ public function actionCreate() @@ -87,19 +95,24 @@ $model = new Product(); $model->detachBehavior('techSpec'); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -114,24 +127,29 @@ { $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } /** * @var ActiveQuery $groups */ $groups = $model->getTaxGroupsByLevel(0); - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'groups' => $groups, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'groups' => $groups, + ] + ); } /** @@ -153,7 +171,7 @@ { $image = ProductImage::findOne($id); - if($image) { + if ($image) { $image->delete(); } @@ -183,13 +201,13 @@ return $this->redirect([ 'index' ]); } - public function actionAkciya($id) + public function actionIsDiscount($id) { $model = $this->findModel($id); - $model->akciya = intval(empty( $model->akciya )); + $model->is_discount = intval(empty( $model->is_discount )); - $model->save(false, [ 'akciya' ]); + $model->save(false, [ 'is_discount' ]); return $this->redirect([ 'index' ]); } @@ -199,43 +217,51 @@ $model = new Import(); $languages = Language::find() - ->select([ - 'name', - 'id', - ]) + ->select( + [ + 'name', + 'id', + ] + ) ->where([ 'status' => 1 ]) ->orderBy([ 'default' => SORT_DESC ]) ->asArray() ->indexBy('id') ->column(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { \Yii::$app->session->set('export_lang', $model->lang); $file = UploadedFile::getInstances($model, 'file'); $method = 'go' . ucfirst($model->type); $target = Yii::getAlias('@uploadDir') . '/' . Yii::getAlias('@uploadFile' . ucfirst($model->type)); - if(empty( $file )) { + if (empty( $file )) { $model->errors[] = 'File not upload'; - } elseif($method == 'goPrices' && $file[ 0 ]->name != 'file_1.csv') { + } elseif ($method == 'goPrices' && $file[ 0 ]->name != 'file_1.csv') { $model->errors[] = 'File need "file_1.csv"'; - } elseif($method == 'goProducts' && $file[ 0 ]->name == 'file_1.csv') { + } elseif ($method == 'goProducts' && $file[ 0 ]->name == 'file_1.csv') { $model->errors[] = 'File can not "file_1.csv"'; - } elseif($model->validate() && $file[ 0 ]->saveAs($target)) { + } elseif ($model->validate() && $file[ 0 ]->saveAs($target)) { // PROCESS PAGE - return $this->render('import-process', [ - 'model' => $model, - 'method' => $model->type, - 'target' => $target, - ]); + return $this->render( + 'import-process', + [ + 'model' => $model, + 'method' => $model->type, + 'target' => $target, + ] + ); } else { $model->errors[] = 'File can not be upload or other error'; } } - return $this->render('import', [ - 'model' => $model, - 'languages' => $languages, - ]); + return $this->render( + 'import', + [ + 'model' => $model, + 'languages' => $languages, + ] + ); } public function actionProducts() @@ -244,7 +270,7 @@ $model = new Import(); - if(Yii::$app->request->isAjax) { + if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return $model->goProducts($from, 1); } else { @@ -258,7 +284,7 @@ $model = new Import(); - if(Yii::$app->request->isAjax) { + if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return $model->goPrices($from, 10); } else { @@ -270,7 +296,7 @@ { $model = new Export(); - if(Yii::$app->request->isAjax) { + if (Yii::$app->request->isAjax) { Yii::$app->response->format = Response::FORMAT_JSON; return $model->process($filename, $from); } else { @@ -282,17 +308,23 @@ { $model = new Export(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { \Yii::$app->session->set('export_lang', $model->lang); - return $this->render('export-process', [ - 'model' => $model, - 'method' => 'export', - ]); + return $this->render( + 'export-process', + [ + 'model' => $model, + 'method' => 'export', + ] + ); } - return $this->render('export', [ - 'model' => $model, - ]); + return $this->render( + 'export', + [ + 'model' => $model, + ] + ); } /** @@ -306,10 +338,10 @@ */ protected function findModel($id) { - if(( $model = Product::find() - ->where([ 'id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = Product::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { diff --git a/common/modules/product/controllers/ProductUnitController.php b/common/modules/product/controllers/ProductUnitController.php index 13d6b77..bf0d6b8 100755 --- a/common/modules/product/controllers/ProductUnitController.php +++ b/common/modules/product/controllers/ProductUnitController.php @@ -32,6 +32,7 @@ /** * Lists all ProductUnit models. + * * @return mixed */ public function actionIndex() @@ -39,10 +40,13 @@ $searchModel = new ProductUnitSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ] + ); } /** @@ -54,33 +58,42 @@ */ public function actionView($id) { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); + return $this->render( + 'view', + [ + 'model' => $this->findModel($id), + ] + ); } /** * Creates a new ProductUnit model. * If creation is successful, the browser will be redirected to the 'view' page. + * * @return mixed */ public function actionCreate() { $model = new ProductUnit(); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->product_unit_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -95,19 +108,24 @@ { $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'view', - 'id' => $model->product_unit_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'view', + 'id' => $model->id, + ] + ); } } - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + ] + ); } /** @@ -137,10 +155,10 @@ */ protected function findModel($id) { - if(( $model = ProductUnit::find() - ->where([ 'product_unit_id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = ProductUnit::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { diff --git a/common/modules/product/controllers/VariantController.php b/common/modules/product/controllers/VariantController.php index 02acb53..c22ecde 100755 --- a/common/modules/product/controllers/VariantController.php +++ b/common/modules/product/controllers/VariantController.php @@ -54,11 +54,14 @@ $query->with('image') ->andWhere([ 'product_id' => $product->id ]); - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'product' => $product, - ]); + return $this->render( + 'index', + [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + 'product' => $product, + ] + ); } /** @@ -72,10 +75,13 @@ { $model = $this->findModel($id); $properties = $model->getProperties(); - return $this->render('view', [ - 'model' => $model, - 'properties' => $properties, - ]); + return $this->render( + 'view', + [ + 'model' => $model, + 'properties' => $properties, + ] + ); } /** @@ -92,17 +98,17 @@ $model = new ProductVariant(); $model->product_id = $product->id; $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { + if ($model->save() && $model->transactionStatus) { $ProductStocks = Yii::$app->request->post('ProductStock'); $total_quantity = 0; - if(!empty( $ProductStocks ) && is_array($ProductStocks)) { + if (!empty( $ProductStocks ) && is_array($ProductStocks)) { $model->unlinkAll('stocks', true); $sorted_array = []; - foreach($ProductStocks as $subArray) { - if(!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) { - if(!empty( $sorted_array[ $subArray[ 'title' ] ] )) { + foreach ($ProductStocks as $subArray) { + if (!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) { + if (!empty( $sorted_array[ $subArray[ 'title' ] ] )) { $sorted_array[ $subArray[ 'title' ] ] += $subArray[ 'quantity' ]; } else { $sorted_array[ $subArray[ 'title' ] ] = $subArray[ 'quantity' ]; @@ -115,25 +121,28 @@ ->where([ 'title' => $stock_names ]) ->indexBy('title') ->all(); - foreach($ProductStocks as $name => $quantity) { + foreach ($ProductStocks as $name => $quantity) { $quantity = (int) $quantity; - if(!array_key_exists($name, $stocks)) { - $stock = new Stock([ - 'title' => $name, - ]); - if(!$stock->save()) { + if (!array_key_exists($name, $stocks)) { + $stock = new Stock( + [ + 'title' => $name, + ] + ); + if (!$stock->save()) { continue; } } else { $stock = $stocks[ $name ]; } - $psModel = new ProductStock([ - 'product_id' => $model->product_id, - 'product_variant_id' => $model->product_variant_id, - 'stock_id' => $stock->stock_id, - 'quantity' => $quantity, - ]); - if($psModel->save()) { + $psModel = new ProductStock( + [ + 'product_variant_id' => $model->id, + 'stock_id' => $stock->id, + 'quantity' => $quantity, + ] + ); + if ($psModel->save()) { $total_quantity += $quantity; } } @@ -142,22 +151,27 @@ } $model->stock = $total_quantity; - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'index', - 'product_id' => $product->id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'index', + 'product_id' => $product->id, + ] + ); } } } $groups = $model->getTaxGroupsByLevel(1); - return $this->render('create', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'groups' => $groups, - 'stocks' => [ new ProductStock() ], - 'product' => $product, - ]); + return $this->render( + 'create', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'groups' => $groups, + 'stocks' => [ new ProductStock() ], + 'product' => $product, + ] + ); } /** @@ -174,17 +188,17 @@ $product = $this->findProduct($product_id); $model = $this->findModel($id); $model->generateLangs(); - if($model->load(Yii::$app->request->post())) { + if ($model->load(Yii::$app->request->post())) { $model->loadLangs(\Yii::$app->request); - if($model->save() && $model->transactionStatus) { + if ($model->save() && $model->transactionStatus) { $ProductStocks = Yii::$app->request->post('ProductStock'); $total_quantity = 0; - if(!empty( $ProductStocks ) && is_array($ProductStocks)) { + if (!empty( $ProductStocks ) && is_array($ProductStocks)) { $model->unlinkAll('stocks', true); $sorted_array = []; - foreach($ProductStocks as $subArray) { - if(!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) { - if(!empty( $sorted_array[ $subArray[ 'title' ] ] )) { + foreach ($ProductStocks as $subArray) { + if (!empty( $subArray[ 'title' ] ) && !empty( $subArray[ 'quantity' ] )) { + if (!empty( $sorted_array[ $subArray[ 'title' ] ] )) { $sorted_array[ $subArray[ 'title' ] ] += $subArray[ 'quantity' ]; } else { $sorted_array[ $subArray[ 'title' ] ] = $subArray[ 'quantity' ]; @@ -197,25 +211,28 @@ ->where([ 'title' => $stock_names ]) ->indexBy('title') ->all(); - foreach($ProductStocks as $name => $quantity) { + foreach ($ProductStocks as $name => $quantity) { $quantity = (int) $quantity; - if(!array_key_exists($name, $stocks)) { - $stock = new Stock([ - 'title' => $name, - ]); - if(!$stock->save()) { + if (!array_key_exists($name, $stocks)) { + $stock = new Stock( + [ + 'title' => $name, + ] + ); + if (!$stock->save()) { continue; } } else { $stock = $stocks[ $name ]; } - $psModel = new ProductStock([ - 'product_id' => $model->product_id, - 'product_variant_id' => $model->product_variant_id, - 'stock_id' => $stock->stock_id, - 'quantity' => $quantity, - ]); - if($psModel->save()) { + $psModel = new ProductStock( + [ + 'product_variant_id' => $model->id, + 'stock_id' => $stock->id, + 'quantity' => $quantity, + ] + ); + if ($psModel->save()) { $total_quantity += $quantity; } } @@ -223,22 +240,27 @@ $model->unlinkAll('stocks', true); } $model->stock = $total_quantity; - if($model->save() && $model->transactionStatus) { - return $this->redirect([ - 'index', - 'product_id' => $product_id, - ]); + if ($model->save() && $model->transactionStatus) { + return $this->redirect( + [ + 'index', + 'product_id' => $product_id, + ] + ); } } } $groups = $model->getTaxGroupsByLevel(1); - return $this->render('update', [ - 'model' => $model, - 'modelLangs' => $model->modelLangs, - 'groups' => $groups, - 'stocks' => ( !empty( $model->variantStocks ) ) ? $model->variantStocks : [ new ProductStock ], - 'product' => $product, - ]); + return $this->render( + 'update', + [ + 'model' => $model, + 'modelLangs' => $model->modelLangs, + 'groups' => $groups, + 'stocks' => ( !empty( $model->variantStocks ) ) ? $model->variantStocks : [ new ProductStock ], + 'product' => $product, + ] + ); } /** @@ -256,17 +278,19 @@ $this->findModel($id) ->delete(); - return $this->redirect([ - 'index', - 'product_id' => $product_id, - ]); + return $this->redirect( + [ + 'index', + 'product_id' => $product_id, + ] + ); } public function actionDelimg($id) { $image = ProductImage::findOne($id); - if($image) { + if ($image) { $image->delete(); } @@ -285,10 +309,10 @@ */ protected function findModel($id) { - if(( $model = ProductVariant::find() - ->where([ 'product_variant_id' => $id ]) - ->with('lang') - ->one() ) !== NULL + if (( $model = ProductVariant::find() + ->where([ 'id' => $id ]) + ->with('lang') + ->one() ) !== null ) { return $model; } else { @@ -304,10 +328,10 @@ */ protected function findProduct($product_id) { - if(( $model = Product::find() - ->with('lang') - ->where([ 'id' => $product_id ]) - ->one() ) !== NULL + if (( $model = Product::find() + ->with('lang') + ->where([ 'id' => $product_id ]) + ->one() ) !== null ) { return $model; } else { diff --git a/common/modules/product/helpers/ProductHelper.php b/common/modules/product/helpers/ProductHelper.php index 5d118b9..cd88ab8 100755 --- a/common/modules/product/helpers/ProductHelper.php +++ b/common/modules/product/helpers/ProductHelper.php @@ -20,7 +20,7 @@ public static function getCategories() { return Category::find() - ->getTree(NULL, 'lang'); + ->getTree(null, 'lang'); } public static function getBrands() @@ -37,32 +37,40 @@ public static function getFilterForOption($filter, $key, $value, $remove = false) { $result = $filter; - if(is_array($value)) { - foreach($value as $value_key => $value_items) { - if(!is_array($value_items)) { + if (is_array($value)) { + foreach ($value as $value_key => $value_items) { + if (!is_array($value_items)) { $value_items = [ $value_items ]; } - foreach($value_items as $value_item) { - if($remove && isset( $result[ $key ] ) && ( $i = array_search($value_item, $result[ $key ][ $value_key ]) ) !== false) { + foreach ($value_items as $value_item) { + if ($remove && isset( $result[ $key ] ) && ( $i = array_search( + $value_item, + $result[ $key ][ $value_key ] + ) ) !== false + ) { unset( $result[ $key ][ $value_key ][ $i ] ); - if(empty( $result[ $key ][ $value_key ] )) { + if (empty( $result[ $key ][ $value_key ] )) { unset( $result[ $key ][ $value_key ] ); } } else { - if(!isset( $result[ $key ][ $value_key ] ) || array_search($value_item, $result[ $key ][ $value_key ]) === false) { + if (!isset( $result[ $key ][ $value_key ] ) || array_search( + $value_item, + $result[ $key ][ $value_key ] + ) === false + ) { $result[ $key ][ $value_key ][] = $value_item; } } } } } else { - if($remove && isset( $result[ $key ] ) && ( $i = array_search($value, $result[ $key ]) ) !== false) { + if ($remove && isset( $result[ $key ] ) && ( $i = array_search($value, $result[ $key ]) ) !== false) { unset( $result[ $key ][ $i ] ); - if(empty( $result[ $key ] )) { + if (empty( $result[ $key ] )) { unset( $result[ $key ] ); } } else { - if(!isset( $result[ $key ] ) || array_search($value, $result[ $key ]) === false) { + if (!isset( $result[ $key ] ) || array_search($value, $result[ $key ]) === false) { $result[ $key ][] = $value; } } @@ -73,9 +81,9 @@ public static function addLastProsucts($product_id) { $last_products = self::getLastProducts(); - if(!in_array($product_id, $last_products)) { + if (!in_array($product_id, $last_products)) { $last_products[] = intval($product_id); - if(count($last_products) > 16) { + if (count($last_products) > 16) { array_shift($last_products); } Yii::$app->session->set('last_products', $last_products); @@ -85,24 +93,26 @@ public static function getLastProducts($as_object = false) { $last_products = Yii::$app->session->get('last_products', []); - if($as_object) { + if ($as_object) { $last_products = Product::find() ->joinWith([ 'variant' ]) ->where([ Product::tableName() . '.id' => $last_products ]) - ->andWhere([ - '!=', - ProductVariant::tableName() . '.stock', - 0, - ]) + ->andWhere( + [ + '!=', + ProductVariant::tableName() . '.stock', + 0, + ] + ) ->all(); } return array_reverse($last_products); } - public static function getSpecialProducts($type, $count, $sort = NULL) + public static function getSpecialProducts($type, $count, $sort = null) { $data = []; - switch($type) { + switch ($type) { case 'top': $data = [ 'is_top' => true ]; break; @@ -110,18 +120,20 @@ $data = [ 'is_new' => true ]; break; case 'promo': - $data = [ 'akciya' => true ]; + $data = [ 'is_discount' => true ]; break; } return Product::find() ->with('lang') ->joinWith('variants.lang') ->where($data) - ->andWhere([ - '!=', - ProductVariant::tableName() . '.stock', - 0, - ]) + ->andWhere( + [ + '!=', + ProductVariant::tableName() . '.stock', + 0, + ] + ) ->limit($count) ->all(); } @@ -134,51 +146,58 @@ */ public static function getSimilarProducts($product, $count = 10) { - if(!is_object($product)) { + if (!is_object($product)) { $product = Product::find() ->where([ 'id' => $product ]) ->with('enabledVariants') ->one(); } - if(!$product->properties) { + if (!$product->properties) { return []; } $product_categories = []; - foreach($product->categories as $category) { + foreach ($product->categories as $category) { $product_categories[] = $category->id; } $query = Product::find() ->select('product.id') ->innerJoinWith('variant') ->joinWith('category') - ->where([ - '!=', - 'product_variant.stock', - 0, - ]) + ->where( + [ + '!=', + 'product_variant.stock', + 0, + ] + ) ->andWhere([ 'product_category.category_id' => $product_categories ]); - foreach($product->properties as $group) { + foreach ($product->properties as $group) { $where = []; - foreach($group->options as $option) { + foreach ($group->options as $option) { $where[] = $option->tax_option_id; } - if(!$where) { + if (!$where) { continue; } - $query->innerJoin('product_option to' . $group->tax_group_id, 'to' . $group->tax_group_id . '.product_id = product.id'); + $query->innerJoin( + 'product_option to' . $group->tax_group_id, + 'to' . $group->tax_group_id . '.product_id = product.id' + ); $query->andWhere([ 'to' . $group->tax_group_id . '.option_id' => $where ]); } - $query->andWhere([ - '!=', - 'product.id', - $product->id, - ]); + $query->andWhere( + [ + '!=', + 'product.id', + $product->id, + ] + ); $query->groupBy('product.id'); $query->limit($count); $products = $query->asArray() ->all(); - foreach($products as &$_product) { + foreach ($products as &$_product) { $_product = Product::findOne($_product[ 'id' ]); } return $products; @@ -193,39 +212,47 @@ */ public static function setQueryParams(&$query, $params, $setPriceLimits = true) { - if(!empty( $params[ 'keywords' ] )) { - if(!is_array($params[ 'keywords' ])) { + if (!empty( $params[ 'keywords' ] )) { + if (!is_array($params[ 'keywords' ])) { $params[ 'keywords' ] = [ $params[ 'keywords' ] ]; } - foreach($params[ 'keywords' ] as $keyword) { - $query->orFilterWhere([ - 'ilike', - Product::tableName() . '.name', - $keyword, - ]); - $query->orFilterWhere([ - 'ilike', - Brand::tableName() . '.name', - $keyword, - ]); - $query->orFilterWhere([ - 'ilike', - Category::tableName() . '.name', - $keyword, - ]); - $query->orFilterWhere([ - 'ilike', - ProductVariant::tableName() . '.sku', - $keyword, - ]); + foreach ($params[ 'keywords' ] as $keyword) { + $query->orFilterWhere( + [ + 'ilike', + Product::tableName() . '.name', + $keyword, + ] + ); + $query->orFilterWhere( + [ + 'ilike', + Brand::tableName() . '.name', + $keyword, + ] + ); + $query->orFilterWhere( + [ + 'ilike', + Category::tableName() . '.name', + $keyword, + ] + ); + $query->orFilterWhere( + [ + 'ilike', + ProductVariant::tableName() . '.sku', + $keyword, + ] + ); } } - foreach($params as $key => $param) { + foreach ($params as $key => $param) { - switch($key) { + switch ($key) { case 'special': - foreach($param as $inner_key => $value) { + foreach ($param as $inner_key => $value) { $query->orFilterWhere([ Product::tableName() . '.' . $inner_key => $value ]); } break; @@ -235,42 +262,54 @@ case 'keywords': break; case 'prices': - if($param[ 'min' ] > 0) { - $query->andWhere([ - '>=', - ProductVariant::tableName() . '.price', - $param[ 'min' ], - ]); + if ($param[ 'min' ] > 0) { + $query->andWhere( + [ + '>=', + ProductVariant::tableName() . '.price', + $param[ 'min' ], + ] + ); } - if($param[ 'max' ] > 0) { - $query->andWhere([ - '<=', - ProductVariant::tableName() . '.price', - $param[ 'max' ], - ]); + if ($param[ 'max' ] > 0) { + $query->andWhere( + [ + '<=', + ProductVariant::tableName() . '.price', + $param[ 'max' ], + ] + ); } break; default: /** * @todo Refactor this */ - $query->andWhere(Product::tableName() . '.id IN ( + $query->andWhere( + Product::tableName() . '.id IN ( SELECT DISTINCT products FROM ( SELECT id AS products FROM product_option INNER JOIN tax_option ON tax_option.tax_option_id = product_option.option_id INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id - WHERE tax_group.alias LIKE \'' . $key . '\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\') OR product_id IN ( + WHERE tax_group.alias LIKE \'' . $key . '\' AND tax_option.alias IN (\'' . implode( + '\',\'', + $param + ) . '\') OR product_id IN ( (SELECT product_id AS products FROM product_variant_option - INNER JOIN product_variant ON product_variant_option.product_variant_id = product_variant.product_variant_id + INNER JOIN product_variant ON product_variant_option.product_variant_id = product_variant.id INNER JOIN tax_option ON tax_option.tax_option_id = product_variant_option.option_id INNER JOIN tax_group ON tax_group.tax_group_id = tax_option.tax_group_id - WHERE tax_group.alias LIKE \'' . $key . '\' AND tax_option.alias IN (\'' . implode('\',\'', $param) . '\')) + WHERE tax_group.alias LIKE \'' . $key . '\' AND tax_option.alias IN (\'' . implode( + '\',\'', + $param + ) . '\')) ) ) AS table_name - )'); + )' + ); break; } @@ -285,16 +324,16 @@ * * @return ActiveQuery */ - public static function productCountQuery($category = NULL, $params, $excludeKeys = []) + public static function productCountQuery($category = null, $params, $excludeKeys = []) { $p = []; - foreach($params as $key => $param) { - if(in_array($key, $excludeKeys)) { + foreach ($params as $key => $param) { + if (in_array($key, $excludeKeys)) { $p[ $key ] = $param; } } /** @var ActiveQuery $query */ - if(!empty( $category )) { + if (!empty( $category )) { $query = $category->getProducts(); } else { $query = Product::find(); diff --git a/common/modules/product/models/Category.php b/common/modules/product/models/Category.php index 1197860..367b2b2 100755 --- a/common/modules/product/models/Category.php +++ b/common/modules/product/models/Category.php @@ -14,6 +14,7 @@ /** * This is the model class for table "category". + * * @todo Write doc for ArtboxTreeBehavior * @property integer $category_id * @property integer $remote_id @@ -25,7 +26,7 @@ * @property Product[] $products * @property ProductUnit $productUnit * @property ProductCategory[] $productCategories - * * From language behavior * + * * From language behavior * * @property CategoryLang $lang * @property CategoryLang[] $langs * @property CategoryLang $objectLang @@ -44,13 +45,13 @@ * @method bool linkLangs() * @method bool saveLangs() * @method bool getTransactionStatus() - * * End language behavior * - * * From SaveImgBehavior + * * End language behavior * + * * From SaveImgBehavior * @property string|null $imageFile * @property string|null $imageUrl * @method string|null getImageFile( int $field ) * @method string|null getImageUrl( int $field ) - * * End SaveImgBehavior + * * End SaveImgBehavior */ class Category extends ActiveRecord { @@ -60,7 +61,7 @@ return [ 'artboxtree' => [ 'class' => ArtboxTreeBehavior::className(), - 'keyNameGroup' => NULL, + 'keyNameGroup' => null, 'keyNamePath' => 'path', ], 'language' => [ @@ -115,7 +116,7 @@ public function attributeLabels() { return [ - 'id' => Yii::t('product', 'Category ID'), + 'id' => Yii::t('product', 'Category ID'), 'parent_id' => Yii::t('product', 'Parent ID'), 'path' => Yii::t('product', 'Path'), 'depth' => Yii::t('product', 'Depth'), @@ -136,7 +137,7 @@ */ public function getProductUnit() { - return $this->hasOne(ProductUnit::className(), [ 'product_unit_id' => 'product_unit_id' ]); + return $this->hasOne(ProductUnit::className(), [ 'id' => 'product_unit_id' ]); } public function getProducts() @@ -171,9 +172,9 @@ public function beforeSave($insert) { - if(parent::beforeSave($insert)) { + if (parent::beforeSave($insert)) { - if(empty( $this->parent_id )) { + if (empty( $this->parent_id )) { $this->parent_id = 0; } @@ -185,53 +186,76 @@ public function getActiveFilters() { $query1 = ( new Query() )->distinct() - ->select([ - 'option_id', - ]) + ->select( + [ + 'option_id', + ] + ) ->from('tax_option') - ->innerJoin('product_variant_option', 'tax_option.tax_option_id = product_variant_option.option_id') + ->innerJoin( + 'product_variant_option', + 'tax_option.tax_option_id = product_variant_option.option_id' + ) ->innerJoin('tax_group', 'tax_group.tax_group_id = tax_option.tax_group_id') - ->innerJoin('product_variant', 'product_variant.product_variant_id = product_variant_option.product_variant_id') + ->innerJoin( + 'product_variant', + 'product_variant.id = product_variant_option.product_variant_id' + ) ->innerJoin('product', 'product.id = product_variant.product_id') ->innerJoin('product_category', 'product_category.product_id = product.id') - ->where([ - 'product_category.category_id' => $this->id, - 'tax_group.is_filter' => true, - ]) - ->andWhere([ - '!=', - 'product_variant.stock', - 0, - ]); + ->where( + [ + 'product_category.category_id' => $this->id, + 'tax_group.is_filter' => true, + ] + ) + ->andWhere( + [ + '!=', + 'product_variant.stock', + 0, + ] + ); $query2 = ( new Query() )->distinct() - ->select([ - 'option_id', - ]) + ->select( + [ + 'option_id', + ] + ) ->from('tax_option') - ->innerJoin('product_option', 'tax_option.tax_option_id = product_option.option_id') + ->innerJoin( + 'product_option', + 'tax_option.tax_option_id = product_option.option_id' + ) ->innerJoin('tax_group', 'tax_group.tax_group_id = tax_option.tax_group_id') ->innerJoin('product', 'product.id = product_option.product_id') ->innerJoin('product_category', 'product_category.product_id = product.id') ->innerJoin('product_variant', 'product_variant.product_id = product.id') - ->where([ - 'product_category.category_id' => $this->id, - 'tax_group.is_filter' => true, - ]) - ->andWhere([ - '!=', - 'product_variant.stock', - 0, - ]); - $query3 = ( new Query() )->select([ - 'tax_option.*', - 'tax_group.*', - 'tax_option.alias as option_alias', - 'tax_group.alias as group_alias', - 'tax_option.value as value', - 'tax_option.sort AS tax_option_sort', - 'tax_group.sort AS tax_group_sort', - ]) + ->where( + [ + 'product_category.category_id' => $this->id, + 'tax_group.is_filter' => true, + ] + ) + ->andWhere( + [ + '!=', + 'product_variant.stock', + 0, + ] + ); + $query3 = ( new Query() )->select( + [ + 'tax_option.*', + 'tax_group.*', + 'tax_option.alias as option_alias', + 'tax_group.alias as group_alias', + 'tax_option.value as value', + 'tax_option.sort AS tax_option_sort', + 'tax_group.sort AS tax_group_sort', + ] + ) ->from([ 'tax_option' ]) ->where([ 'tax_option.tax_option_id' => $query1->union($query2) ]) ->innerJoin('tax_group', 'tax_group.tax_group_id = tax_option.tax_group_id') @@ -242,7 +266,8 @@ public function getTaxGroupsForMenu() { $connection = Yii::$app->getDb(); - $command = $connection->createCommand(' + $command = $connection->createCommand( + ' SELECT ton.alias AS option_alias, * FROM tax_option AS ton RIGHT JOIN tax_group ON ton.tax_group_id = tax_group.tax_group_id @@ -253,10 +278,12 @@ SELECT product_id FROM product_category WHERE category_id = :category_id ) ) - AND tax_group.is_menu = TRUE AND tax_group_to_category.category_id = :category_id', [ - ':category_id' => $this->id, - - ]); + AND tax_group.is_menu = TRUE AND tax_group_to_category.category_id = :category_id', + [ + ':category_id' => $this->id, + + ] + ); return $command->queryAll(); } diff --git a/common/modules/product/models/Export.php b/common/modules/product/models/Export.php index 72fc9e8..e0a051c 100755 --- a/common/modules/product/models/Export.php +++ b/common/modules/product/models/Export.php @@ -32,11 +32,11 @@ ]; } - public function process($filename = NULL, $from = 0) + public function process($filename = null, $from = 0) { $limit = 100; - if(empty( $filename )) { + if (empty( $filename )) { $filename = 'products_' . date('d_m_Y_H_i') . '.csv'; $handle = fopen(\Yii::getAlias('@storage/sync/') . $filename, "w"); } else { @@ -58,25 +58,29 @@ $filesize = Product::find() ->joinWith('lang', true, 'INNER JOIN') ->count(); - foreach($products as $product) { + foreach ($products as $product) { $mods = []; $filterString = $this->convertFilterToString($product->filters); - foreach($product->variantsWithFilters as $variant) { + foreach ($product->variantsWithFilters as $variant) { /** * @var ProductVariant $variant */ $color = $variant->lang->title; - $mods[] = $variant->sku . $this->generateID($variant->remote_id) . '=' . $this->convertFilterToString($variant->filters) . '=' . $color . '=' . ( ( !empty( $variant->image ) ) ? $variant->image->image : '' ) . '=' . $variant->stock; + $mods[] = $variant->sku . $this->generateID( + $variant->remote_id + ) . '=' . $this->convertFilterToString( + $variant->filters + ) . '=' . $color . '=' . ( ( !empty( $variant->image ) ) ? $variant->image->image : '' ) . '=' . $variant->stock; } $fotos = []; - foreach($product->images as $image) { + foreach ($product->images as $image) { $fotos[] = $image->image; } $categories = []; - foreach($product->categories as $value) { + foreach ($product->categories as $value) { $categories[] = $value->lang->title . $this->generateID($value->remote_id); } @@ -85,7 +89,9 @@ $list = [ $categories, //A - категории через запятую Название(remote_id) - ( ( !empty( $product->brand ) ) ? $product->brand->lang->title . $this->generateID($product->brand->remote_id) : '' ), + ( ( !empty( $product->brand ) ) ? $product->brand->lang->title . $this->generateID( + $product->brand->remote_id + ) : '' ), //B - бренд Название(remote_id) $product->lang->title . $this->generateID($product->remote_id), //C - название товара Название(remote_id) @@ -97,7 +103,7 @@ //F - страрая цена ( !empty( $product->variant ) ) ? $product->variant->price : '', //G - новая цена - intval($product->akciya), + intval($product->is_discount), //H - товар акционный (1/0) '', //I - пустой @@ -120,7 +126,7 @@ $from += $limit; $end = false; - if($from > $filesize) { + if ($from > $filesize) { $end = true; } @@ -131,10 +137,13 @@ 'filename' => $filename, ]; - if($end) { - $result = array_merge($result, [ - 'link' => '/storage/sync/' . $filename, - ]); + if ($end) { + $result = array_merge( + $result, + [ + 'link' => '/storage/sync/' . $filename, + ] + ); } return $result; @@ -147,12 +156,14 @@ /** * @var TaxOption[] $filters */ - foreach($filters as $filter) { - $fittersArray[ $filter->taxGroup->lang->title . $this->generateID($filter->taxGroup->remote_id) ][] = $filter->lang->value . $this->generateID($filter->remote_id); + foreach ($filters as $filter) { + $fittersArray[ $filter->taxGroup->lang->title . $this->generateID( + $filter->taxGroup->remote_id + ) ][] = $filter->lang->value . $this->generateID($filter->remote_id); } $filterString = []; - foreach($fittersArray as $filterName => $filterRows) { + foreach ($fittersArray as $filterName => $filterRows) { $row = implode(',', $filterRows); $filterString[] = "[{$filterName}:{$row}]"; } diff --git a/common/modules/product/models/Import.php b/common/modules/product/models/Import.php index d703f97..c951ea9 100755 --- a/common/modules/product/models/Import.php +++ b/common/modules/product/models/Import.php @@ -63,33 +63,42 @@ public function getType() { - if(!$this->type) { + if (!$this->type) { $this->type = 'products'; } return $this->type; } - public function goPrices($from = 0, $limit = NULL) + public function goPrices($from = 0, $limit = null) { set_time_limit(0); - if(!( $handle = $this->getProductsFile('uploadFilePrices') )) { + if (!( $handle = $this->getProductsFile('uploadFilePrices') )) { $this->errors[] = 'File not found'; return false; } $filesize = filesize(Yii::getAlias('@uploadDir') . '/' . Yii::getAlias('@uploadFilePrices')); - if($from) { + if ($from) { fseek($handle, $from); } $j = 0; - $is_utf = ( preg_match('//u', file_get_contents(Yii::getAlias('@uploadDir') . '/' . Yii::getAlias('@uploadFilePrices'), NULL, NULL, NULL, 1000000)) ); + $is_utf = ( preg_match( + '//u', + file_get_contents( + Yii::getAlias('@uploadDir') . '/' . Yii::getAlias('@uploadFilePrices'), + null, + null, + null, + 1000000 + ) + ) ); - while(( empty( $limit ) || $j++ < $limit ) && ( $data = fgetcsv($handle, 10000, ";") ) !== false) { - foreach($data as &$value) { - if(!$is_utf) { + while (( empty( $limit ) || $j++ < $limit ) && ( $data = fgetcsv($handle, 10000, ";") ) !== false) { + foreach ($data as &$value) { + if (!$is_utf) { $value = iconv('windows-1251', "UTF-8//TRANSLIT//IGNORE", $value); } $value = trim($value); @@ -103,29 +112,29 @@ $city_name = @$data[ 4 ]; $product_title = @$data[ 5 ]; - if(empty ( $modification_code )) { + if (empty ( $modification_code )) { continue; } // товары в пути - if(empty ( $city_name )) { + if (empty ( $city_name )) { $this->output[] = 'Товар ' . $product_title . ' в пути'; continue; } /** * @var ProductVariant $productVariant */ - if(( $productVariant = ProductVariant::find() - ->filterWhere([ 'sku' => $modification_code ]) - ->one() ) === NULL + if (( $productVariant = ProductVariant::find() + ->filterWhere([ 'sku' => $modification_code ]) + ->one() ) === null ) { $this->output[] = 'Для товара ' . $product_title . ' не найдено соотвествие'; continue; } // ===== Set stock ==== - if($city_name) { - if(( $stock = Stock::find() - ->filterWhere([ 'title' => trim($city_name) ]) - ->one() ) === NULL + if ($city_name) { + if (( $stock = Stock::find() + ->filterWhere([ 'title' => trim($city_name) ]) + ->one() ) === null ) { // Create stock $stock = new Stock(); @@ -134,37 +143,44 @@ } $productStock = ProductStock::find() - ->where([ - 'product_variant_id' => $productVariant->product_variant_id, - 'stock_id' => $stock->stock_id, - ]) + ->where( + [ + 'product_variant_id' => $productVariant->id, + 'stock_id' => $stock->id, + ] + ) ->one(); - if(!$productStock instanceof ProductStock) { - $productStock = new ProductStock; - $productStock->product_variant_id = $productVariant->product_variant_id; - $productStock->stock_id = $stock->stock_id; - $productStock->product_id = $productVariant->product_id; + if (!$productStock instanceof ProductStock) { + $productStock = new ProductStock(); + $productStock->product_variant_id = $productVariant->id; + $productStock->stock_id = $stock->id; } $productStock->quantity = $count; $productStock->save(false); $productStocks = ProductStock::find() - ->where([ 'product_variant_id' => $productVariant->product_variant_id ]) - ->andWhere([ - '<>', - 'stock_id', - $stock->stock_id, - ]) + ->where( + [ 'product_variant_id' => $productVariant->id ] + ) + ->andWhere( + [ + '<>', + 'stock_id', + $stock->id, + ] + ) ->all(); $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; } else { $productStocks = ProductStock::find() - ->where([ 'product_variant_id' => $productVariant->product_variant_id ]) + ->where( + [ 'product_variant_id' => $productVariant->id ] + ) ->all(); - if($productStocks instanceof ProductStock) { + if ($productStocks instanceof ProductStock) { $quantity = array_sum(ArrayHelper::getColumn($productStocks, 'quantity')) + $count; } else { $quantity = 0; @@ -172,7 +188,7 @@ } - if($price_promo) { + if ($price_promo) { $productVariant->price_old = $price; $productVariant->price = $price_promo; } else { @@ -197,7 +213,7 @@ fclose($handle); - if($result[ 'end' ]) { + if ($result[ 'end' ]) { unlink(Yii::getAlias('@uploadDir') . '/' . Yii::getAlias('@uploadFilePrices')); } @@ -214,8 +230,8 @@ $pattern = '/^(?P= Html::a(Yii::t('product', 'Create Product Unit'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
- = GridView::widget([ - 'dataProvider' => $dataProvider, - 'filterModel' => $searchModel, - 'columns' => [ - 'product_unit_id', - [ - 'attribute' => 'is_default', - 'format' => 'boolean', - 'filter' => [ - \Yii::$app->formatter->asBoolean(false), - \Yii::$app->formatter->asBoolean(true), + = GridView::widget( + [ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + 'id', + [ + 'attribute' => 'is_default', + 'format' => 'boolean', + 'filter' => [ + \Yii::$app->formatter->asBoolean(false), + \Yii::$app->formatter->asBoolean(true), + ], ], + [ + 'attribute' => 'title', + 'value' => 'lang.title', + ], + 'lang.short', + [ 'class' => 'yii\grid\ActionColumn' ], ], - [ - 'attribute' => 'title', - 'value' => 'lang.title', - ], - 'lang.short', - [ 'class' => 'yii\grid\ActionColumn' ], - ], - ]); ?> + ] + ); ?>- = Html::a(Yii::t('product', 'Update'), [ - 'update', - 'id' => $model->product_unit_id, - ], [ 'class' => 'btn btn-primary' ]) ?> - = Html::a(Yii::t('product', 'Delete'), [ - 'delete', - 'id' => $model->product_unit_id, - ], [ - 'class' => 'btn btn-danger', - 'data' => [ - 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'), - 'method' => 'post', + = Html::a( + Yii::t('product', 'Update'), + [ + 'update', + 'id' => $model->id, ], - ]) ?> + [ 'class' => 'btn btn-primary' ] + ) ?> + = Html::a( + Yii::t('product', 'Delete'), + [ + 'delete', + 'id' => $model->id, + ], + [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => Yii::t('product', 'Are you sure you want to delete this item?'), + 'method' => 'post', + ], + ] + ) ?>
- = DetailView::widget([ - 'model' => $model, - 'attributes' => [ - 'product_unit_id', - 'is_default:boolean', - 'lang.title', - 'lang.short', - ], - ]) ?> + = DetailView::widget( + [ + 'model' => $model, + 'attributes' => [ + 'id', + 'is_default:boolean', + 'lang.title', + 'lang.short', + ], + ] + ) ?> diff --git a/common/modules/product/views/variant/_form.php b/common/modules/product/views/variant/_form.php index 94d8cb5..d8078de 100755 --- a/common/modules/product/views/variant/_form.php +++ b/common/modules/product/views/variant/_form.php @@ -78,7 +78,7 @@ $(".dynamicform_wrapper").on("limitReached", function(e, item) { 'overwriteInitial' => false, 'showRemove' => false, 'showUpload' => false, - 'uploadAsync' => !empty( $model->product_variant_id ), + 'uploadAsync' => !empty( $model->id ), 'previewFileType' => 'image', ], ] diff --git a/common/modules/product/views/variant/index.php b/common/modules/product/views/variant/index.php index 727cd59..f32c110 100755 --- a/common/modules/product/views/variant/index.php +++ b/common/modules/product/views/variant/index.php @@ -50,7 +50,7 @@ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [ - 'product_variant_id', + 'id', [ 'attribute' => 'variantName', 'value' => 'lang.title', @@ -70,7 +70,7 @@ [ 'view', 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, + 'id' => $model->id, ] ), [ @@ -85,7 +85,7 @@ [ 'update', 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, + 'id' => $model->id, ] ), [ @@ -101,7 +101,7 @@ [ 'delete', 'product_id' => $model->product_id, - 'id' => $model->product_variant_id, + 'id' => $model->id, ] ), [ diff --git a/common/modules/product/views/variant/update.php b/common/modules/product/views/variant/update.php index b4d8000..7d96988 100755 --- a/common/modules/product/views/variant/update.php +++ b/common/modules/product/views/variant/update.php @@ -49,7 +49,7 @@ 'url' => Url::to( [ 'view', - 'id' => $model->product_variant_id, + 'id' => $model->id, ] ), ]; diff --git a/common/modules/product/views/variant/view.php b/common/modules/product/views/variant/view.php index aa05ea8..0ac8a30 100755 --- a/common/modules/product/views/variant/view.php +++ b/common/modules/product/views/variant/view.php @@ -47,7 +47,7 @@ Yii::t('product', 'Update'), [ 'update', - 'id' => $model->product_variant_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-primary' ] ) ?> @@ -55,7 +55,7 @@ Yii::t('product', 'Delete'), [ 'delete', - 'id' => $model->product_variant_id, + 'id' => $model->id, ], [ 'class' => 'btn btn-danger', @@ -71,7 +71,7 @@ [ 'model' => $model, 'attributes' => [ - 'product_variant_id', + 'id', 'lang.title', 'sku', 'price', diff --git a/common/modules/product/widgets/views/product_smart.php b/common/modules/product/widgets/views/product_smart.php index d7987cb..81ff5e9 100755 --- a/common/modules/product/widgets/views/product_smart.php +++ b/common/modules/product/widgets/views/product_smart.php @@ -11,24 +11,36 @@