Commit 727d4d0e59ea1202573139ddd71c59ee7faaef4f

Authored by Anastasia
1 parent cde29fdf

- debug

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