Commit 727d4d0e59ea1202573139ddd71c59ee7faaef4f
1 parent
cde29fdf
- debug
Showing
5 changed files
with
14 additions
and
13 deletions
Show diff stats
frontend/controllers/ServiceController.php
... | ... | @@ -19,11 +19,11 @@ |
19 | 19 | public function actionView($id){ |
20 | 20 | $model = $this->findModel($id); |
21 | 21 | if ($model->parent_id == null){ |
22 | - $others = Service::find()->where(['parent_id' => $model->id])->with('services')->all(); | |
22 | + $others = Service::find()->where(['parent_id' => $model->id])->with('services.language.alias')->all(); | |
23 | 23 | }elseif ($model->level == 1){ |
24 | - $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services')->all(); | |
24 | + $others = Service::find()->where(['parent_id' => $model->parent_id])->with('services.language.alias')->all(); | |
25 | 25 | }else{ |
26 | - $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('service')->where(['id' => $model->parent_id])])->with('services')->all(); | |
26 | + $others = Service::find()->where(['parent_id' => (new Query())->select('parent_id')->from('services.language.alias')->where(['id' => $model->parent_id])])->with('services.language.alias')->all(); | |
27 | 27 | } |
28 | 28 | |
29 | 29 | $model->body = str_replace('[[prices]]', $this->renderPartial('_prices', ['prices' => $model->prices]), $model->body); |
... | ... | @@ -36,12 +36,12 @@ |
36 | 36 | public function findModel($id){ |
37 | 37 | $model = Service::find() |
38 | 38 | ->where(['id' => $id, 'status' => true]) |
39 | - ->with(['language.alias', 'image', 'prices' => function (ActiveQuery $query){ | |
39 | + ->with(['language.alias', 'prices' => function (ActiveQuery $query){ | |
40 | 40 | $query->where(['status' => true])->orderBy('sort'); |
41 | 41 | }, 'comments' => function (ActiveQuery $query){ |
42 | 42 | $query->where(['status' => true]); |
43 | 43 | }, 'questions' => function (ActiveQuery $query){ |
44 | - $query->where(['status' => true]); | |
44 | + $query->where(['status' => true])->with('doctor'); | |
45 | 45 | }])->one(); |
46 | 46 | if (empty($model)){ |
47 | 47 | throw new NotFoundHttpException('Model not found'); | ... | ... |
frontend/controllers/SiteController.php
... | ... | @@ -57,7 +57,7 @@ |
57 | 57 | */ |
58 | 58 | public function actionIndex() |
59 | 59 | { |
60 | - $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->all(); | |
60 | + $slides = Slide::find()->with('language')->where(['status' => true])->orderBy('sort')->with('language.image')->all(); | |
61 | 61 | $services = Service::find()->where(['is not' ,'image_id', NULL])->andWhere( |
62 | 62 | [ |
63 | 63 | 'status' => true, |
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | ) |
67 | 67 | ->with( |
68 | 68 | [ |
69 | + 'image', | |
69 | 70 | 'language.alias', |
70 | 71 | 'services' => function (ActiveQuery $query) { |
71 | 72 | $query->where(['status' => true])->with(['language.alias']); | ... | ... |
frontend/views/layouts/main.php
... | ... | @@ -160,7 +160,7 @@ |
160 | 160 | } |
161 | 161 | $items[] = [ |
162 | 162 | 'label' => $service->title, |
163 | - 'url' => Url::to([ 'alias' => $service->alias ]), | |
163 | + 'url' => Url::to([ 'alias' => $service->language->alias ]), | |
164 | 164 | ]; |
165 | 165 | } |
166 | 166 | $items[] = [ |
... | ... | @@ -198,13 +198,13 @@ |
198 | 198 | foreach ($service->services as $item) { |
199 | 199 | $servicesChild[] = [ |
200 | 200 | 'label' => $item->title, |
201 | - 'url' => Url::to([ 'alias' => $item->alias ]), | |
201 | + 'url' => Url::to([ 'alias' => $item->language->alias ]), | |
202 | 202 | ]; |
203 | 203 | } |
204 | 204 | $itemsMobile[] = [ |
205 | 205 | 'label' => $service->title, |
206 | 206 | 'items' => $servicesChild, |
207 | - 'url' => Url::to([ 'alias' => $service->alias ]), | |
207 | + 'url' => Url::to([ 'alias' => $service->language->alias ]), | |
208 | 208 | ]; |
209 | 209 | } |
210 | 210 | $itemsMobile[] = [ | ... | ... |
frontend/views/service/view.php
... | ... | @@ -28,12 +28,12 @@ |
28 | 28 | <div class="style service-list-wr"> |
29 | 29 | <ul> |
30 | 30 | <?php foreach ($others as $service){?> |
31 | - <li class="<?=(($model->id == $service->id and $model->level != 2) ? 'active' : '')?> <?=(($model->parent_id == $service->id and $model->level == 2) ? 'active2' : '')?> <?=(!empty($service->services) ? 'has-list' : '')?>"><a href="<?=Url::to(['alias' => $service->alias])?>"><?=$service->title?></a> | |
31 | + <li class="<?=(($model->id == $service->id and $model->level != 2) ? 'active' : '')?> <?=(($model->parent_id == $service->id and $model->level == 2) ? 'active2' : '')?> <?=(!empty($service->services) ? 'has-list' : '')?>"><a href="<?=Url::to(['alias' => $service->language->alias])?>"><?=$service->title?></a> | |
32 | 32 | <?php |
33 | 33 | if (($model->id == $service->id or $model->parent_id == $service->id) and !empty($service->services))?> |
34 | 34 | <ul> |
35 | 35 | <?php foreach ($service->services as $item){?> |
36 | - <li class="<?=($model->id == $item->id ? 'active' : '')?>"><a href="<?=Url::to(['alias' => $item->alias])?>"><?=$item->title?></a></li> | |
36 | + <li class="<?=($model->id == $item->id ? 'active' : '')?>"><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li> | |
37 | 37 | <?php }?> |
38 | 38 | </ul> |
39 | 39 | </li> | ... | ... |
frontend/views/site/index.php
... | ... | @@ -95,14 +95,14 @@ JS; |
95 | 95 | <div class="style categories-home-links-wr"> |
96 | 96 | <div class="style categories-home-links-title"> |
97 | 97 | <!--если есть вложенность добавить класс для а "arrow"--> |
98 | - <a <?=(count($service->services) > 0 ? 'class="arrow"' : '')?> href="<?=Url::to(['alias' => $service->alias])?>"><span><?=$service->title?></span></a> | |
98 | + <a <?=(count($service->services) > 0 ? 'class="arrow"' : '')?> href="<?=Url::to(['alias' => $service->language->alias])?>"><span><?=$service->title?></span></a> | |
99 | 99 | </div> |
100 | 100 | <?php if (count($service->services) > 0){?> |
101 | 101 | <!--если есть вложенность--> |
102 | 102 | <div class="style categories-home-links-hidden"> |
103 | 103 | <ul> |
104 | 104 | <?php foreach ($service->services as $item){?> |
105 | - <li><a href="<?=Url::to(['alias' => $item->alias])?>"><?=$item->title?></a></li> | |
105 | + <li><a href="<?=Url::to(['alias' => $item->language->alias])?>"><?=$item->title?></a></li> | |
106 | 106 | <?php } ?> |
107 | 107 | </ul> |
108 | 108 | </div> | ... | ... |