diff --git a/frontend/controllers/ServiceController.php b/frontend/controllers/ServiceController.php index d92f034..08cac89 100644 --- a/frontend/controllers/ServiceController.php +++ b/frontend/controllers/ServiceController.php @@ -10,6 +10,7 @@ use common\models\Service; use yii\db\ActiveQuery; + use yii\db\Query; use yii\web\Controller; use yii\web\NotFoundHttpException; @@ -18,9 +19,11 @@ public function actionView($id){ $model = $this->findModel($id); if ($model->parent_id == null){ - $others = Service::find()->where(['parent_id' => $model->id])->all(); + $others = Service::find()->where(['parent_id' => $model->id])->with('services')->all(); + }elseif ($model->level == 1){ + $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services')->all(); }else{ - $others = Service::find()->where(['parent_id' => $model->parent_id])->all(); + $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with('services')->all(); } $model->body = str_replace('[[prices]]', $this->renderPartial('_prices', ['prices' => $model->prices]), $model->body); diff --git a/frontend/views/service/view.php b/frontend/views/service/view.php index c881c64..c1b36e4 100644 --- a/frontend/views/service/view.php +++ b/frontend/views/service/view.php @@ -28,7 +28,15 @@
-- libgit2 0.21.4