Commit 43a2405958e55842a541140aec4965e763901e87
1 parent
6dd77cde
- servives
- prices - disable artboxmodal css
Showing
9 changed files
with
188 additions
and
15 deletions
Show diff stats
common/models/Service.php
| ... | ... | @@ -151,6 +151,14 @@ class Service extends ActiveRecord |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | public function getPrices(){ |
| 154 | - return$this->hasMany(Price::className(), ['id' => 'service_id']); | |
| 154 | + return $this->hasMany(Price::className(), ['service_id' => 'id']); | |
| 155 | + } | |
| 156 | + | |
| 157 | + public function getComments(){ | |
| 158 | + return $this->hasMany(Comment::className(), ['service_id' => 'id']); | |
| 159 | + } | |
| 160 | + | |
| 161 | + public function getQuestions(){ | |
| 162 | + return $this->hasMany(Question::className(), ['service_id' => 'id']); | |
| 155 | 163 | } |
| 156 | 164 | } | ... | ... |
console/migrations/m180524_152319_create_price_table.php
| ... | ... | @@ -16,7 +16,7 @@ class m180524_152319_create_price_table extends Migration |
| 16 | 16 | 'id' => $this->primaryKey(), |
| 17 | 17 | 'service_id' => $this->integer(), |
| 18 | 18 | 'price' => $this->integer(), |
| 19 | - 'status' => $this->integer(), | |
| 19 | + 'status' => $this->boolean(), | |
| 20 | 20 | 'sort' => $this->integer() |
| 21 | 21 | ]); |
| 22 | 22 | ... | ... |
frontend/config/main.php
frontend/controllers/ServiceController.php
| ... | ... | @@ -9,15 +9,12 @@ |
| 9 | 9 | namespace frontend\controllers; |
| 10 | 10 | |
| 11 | 11 | use common\models\Service; |
| 12 | + use yii\db\ActiveQuery; | |
| 12 | 13 | use yii\web\Controller; |
| 13 | 14 | use yii\web\NotFoundHttpException; |
| 14 | 15 | |
| 15 | 16 | class ServiceController extends Controller |
| 16 | 17 | { |
| 17 | - public function actionIndex(){ | |
| 18 | - | |
| 19 | - } | |
| 20 | - | |
| 21 | 18 | public function actionView($id){ |
| 22 | 19 | $model = $this->findModel($id); |
| 23 | 20 | if ($model->parent_id == null){ |
| ... | ... | @@ -26,6 +23,7 @@ |
| 26 | 23 | $others = Service::find()->where(['parent_id' => $model->parent_id])->all(); |
| 27 | 24 | } |
| 28 | 25 | |
| 26 | + $model->body = str_replace('[[prices]]', $this->renderPartial('_prices', ['prices' => $model->prices]), $model->body); | |
| 29 | 27 | return $this->render('view', [ |
| 30 | 28 | 'model' => $model, |
| 31 | 29 | 'others'=> $others |
| ... | ... | @@ -35,7 +33,11 @@ |
| 35 | 33 | public function findModel($id){ |
| 36 | 34 | $model = Service::find() |
| 37 | 35 | ->where(['id' => $id, 'status' => true]) |
| 38 | - ->with(['language.alias', 'image', 'prices'])->one(); | |
| 36 | + ->with(['language.alias', 'image', 'prices' => function (ActiveQuery $query){ | |
| 37 | + $query->where(['status' => true])->orderBy('sort'); | |
| 38 | + }, 'comments' => function (ActiveQuery $query){ | |
| 39 | + $query->where(['status' => true]); | |
| 40 | + }])->one(); | |
| 39 | 41 | if (empty($model)){ |
| 40 | 42 | throw new NotFoundHttpException('Model not found'); |
| 41 | 43 | } | ... | ... |
frontend/controllers/SiteController.php
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | use common\models\blog\Article; |
| 6 | 6 | use common\models\Comment; |
| 7 | 7 | use common\models\Package; |
| 8 | + use common\models\Price; | |
| 8 | 9 | use common\models\Service; |
| 9 | 10 | use common\models\Settings; |
| 10 | 11 | use common\models\slider\Slide; |
| ... | ... | @@ -176,6 +177,15 @@ |
| 176 | 177 | } |
| 177 | 178 | } |
| 178 | 179 | } |
| 180 | + public function actionPrices(){ | |
| 181 | + $services = Service::find()->innerJoinWith(['prices' => function (ActiveQuery $query){ | |
| 182 | + $query->where(['price.status' => true]); | |
| 183 | + }])->all(); | |
| 184 | + | |
| 185 | + return $this->render('prices', [ | |
| 186 | + 'services' => $services, | |
| 187 | + ]); | |
| 188 | + } | |
| 179 | 189 | |
| 180 | 190 | |
| 181 | 191 | public function actionPage1(){ | ... | ... |
frontend/views/layouts/main.php
| ... | ... | @@ -15,6 +15,7 @@ |
| 15 | 15 | use artbox\core\models\Feedback; |
| 16 | 16 | use artbox\core\models\PageCategory; |
| 17 | 17 | use artbox\core\models\User; |
| 18 | + use artbox\core\seo\widgets\SeoBreadcrumbs; | |
| 18 | 19 | use common\models\Service; |
| 19 | 20 | use common\models\Settings; |
| 20 | 21 | use frontend\assets\AppAsset; |
| ... | ... | @@ -209,7 +210,7 @@ |
| 209 | 210 | } |
| 210 | 211 | $itemsMobile[] = [ |
| 211 | 212 | 'label' => \Yii::t('app', 'Цены'), |
| 212 | - 'url' => '#', | |
| 213 | + 'url' => Url::to(['site/prices']), | |
| 213 | 214 | 'options' => [ |
| 214 | 215 | 'class' => 'active' |
| 215 | 216 | ] |
| ... | ... | @@ -253,6 +254,18 @@ |
| 253 | 254 | <!-- #content должен быть в main.php --> |
| 254 | 255 | <div id="content_" class="section-box-content"> |
| 255 | 256 | <!-- start breadcrumbs --> |
| 257 | + <?php if (!empty($this->params['breadcrumbs'])) {?> | |
| 258 | + <section class="section-breadcrumb"> | |
| 259 | + <div class="container"> | |
| 260 | + <div class="row"> | |
| 261 | + <div class="col-xs-12 col-sm-12 breadcrumb-wrapp"> | |
| 262 | + <?=SeoBreadcrumbs::widget([ | |
| 263 | + 'links' => isset($this->params[ 'breadcrumbs' ]) ? $this->params[ 'breadcrumbs' ] : [], | |
| 264 | + ])?> | |
| 265 | + </div> | |
| 266 | + </div> | |
| 267 | + </section> | |
| 268 | + <?php }?> | |
| 256 | 269 | <!-- если не главная выводить сюда--> |
| 257 | 270 | <!-- end breadcrumbs --> |
| 258 | 271 | |
| ... | ... | @@ -265,17 +278,17 @@ |
| 265 | 278 | <div class="row"> |
| 266 | 279 | <div class="col-xs-12"> |
| 267 | 280 | <div class="map-info-wrapp"> |
| 268 | - <div class="marker-img"><img src="images/map/marker-1.png" width="68" height="80" alt=""></div> | |
| 281 | + <div class="marker-img"><img src="/images/map/marker-1.png" width="68" height="80" alt=""></div> | |
| 269 | 282 | <div class="map-adress"><?=$settings->address?></div> |
| 270 | 283 | <?php if (!empty($settings->phone) or !empty($settings->phone2)){?> |
| 271 | - <div class="ico-map"><img src="images/map/phone-map.svg" alt=""></div> | |
| 284 | + <div class="ico-map"><img src="/images/map/phone-map.svg" alt=""></div> | |
| 272 | 285 | <div class="map-phone"> |
| 273 | 286 | <p><?=$settings->phone?></p> |
| 274 | 287 | <p><?=$settings->phone2?></p> |
| 275 | 288 | </div> |
| 276 | 289 | <?php } ?> |
| 277 | 290 | <?php if (!empty($settings->email)){?> |
| 278 | - <div class="ico-map ico-map-mail"><img src="images/map/mail-map.svg" alt=""></div> | |
| 291 | + <div class="ico-map ico-map-mail"><img src="/images/map/mail-map.svg" alt=""></div> | |
| 279 | 292 | <div class="map-mail"> |
| 280 | 293 | <a href="mailto:<?=$settings->email?>"><?=$settings->email?></a> |
| 281 | 294 | </div> |
| ... | ... | @@ -329,9 +342,9 @@ |
| 329 | 342 | |
| 330 | 343 | <div class="col-xs-3 col-sm-3"> |
| 331 | 344 | <ul class="seti-list"> |
| 332 | - <li><a target="_blank" href="#"><img src="images/s-1.svg" alt=""></a></li> | |
| 333 | - <li><a target="_blank" href="#"><img src="images/s-2.svg" alt=""></a></li> | |
| 334 | - <li><a target="_blank" href="#"><img src="images/s-3.svg" alt=""></a></li> | |
| 345 | + <li><a target="_blank" href="#"><img src="/images/s-1.svg" alt=""></a></li> | |
| 346 | + <li><a target="_blank" href="#"><img src="/images/s-2.svg" alt=""></a></li> | |
| 347 | + <li><a target="_blank" href="#"><img src="/images/s-3.svg" alt=""></a></li> | |
| 335 | 348 | </ul> |
| 336 | 349 | </div> |
| 337 | 350 | </div> |
| ... | ... | @@ -367,7 +380,7 @@ |
| 367 | 380 | <div class="button-call-mob"><a class="call-sms" href="sms:<?= $settings->phone ?>">Отправить SMS</a> |
| 368 | 381 | </div> |
| 369 | 382 | <div class="button-call-mob"> |
| 370 | - <a class="call-contact" href="contacts/abclinic.vcf">Добавить в контакты</a></div> | |
| 383 | + <a class="call-contact" href="/contacts/abclinic.vcf">Добавить в контакты</a></div> | |
| 371 | 384 | </div> |
| 372 | 385 | </div> |
| 373 | 386 | </div> | ... | ... |
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var \common\models\Price[] $prices | |
| 4 | + */ | |
| 5 | + ?> | |
| 6 | +<?php if (!empty($prices)){?> | |
| 7 | +<table> | |
| 8 | + <thead> | |
| 9 | + <tr> | |
| 10 | + <th>Услуги</th> | |
| 11 | + <th>Цена</th> | |
| 12 | + </tr> | |
| 13 | + </thead> | |
| 14 | + <tbody> | |
| 15 | + <?php foreach ($prices as $price){?> | |
| 16 | + <tr> | |
| 17 | + <td><?=$price->title?></td> | |
| 18 | + <td><b><?=$price->price?> <span>грн.</span></b></td> | |
| 19 | + </tr> | |
| 20 | + <?php }?> | |
| 21 | + </tbody> | |
| 22 | +</table> | |
| 23 | +<?php } ?> | ... | ... |
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var \common\models\Service $model; | |
| 4 | + * @var \common\models\Service[] $others; | |
| 5 | + */ | |
| 6 | + use artbox\core\helpers\Url; | |
| 7 | + | |
| 8 | + $this->params[ 'breadcrumbs' ][] = $model->title | |
| 9 | + ?> | |
| 10 | + <section class="section-service-page"> | |
| 11 | + <div class="container"> | |
| 12 | + <div class="row"> | |
| 13 | + <div class="hidden-xs col-xs-12 col-sm-4 col-md-3"> | |
| 14 | + <div class="style service-list-wr"> | |
| 15 | + <ul> | |
| 16 | + <?php foreach ($others as $service){?> | |
| 17 | + <li <?=($model->id == $service->id ? 'class="active"' : '')?>><a href="<?=Url::to(['alias' => $service->alias])?>"><?=$service->title?></a></li> | |
| 18 | + <?php }?> | |
| 19 | + </ul> | |
| 20 | + </div> | |
| 21 | + </div> | |
| 22 | + <div class="col-xs-12 col-sm-8 col-md-9"> | |
| 23 | + <div class="row"> | |
| 24 | + <div class="col-xs-12"> | |
| 25 | + <h1 class="title-pages"><?=$model->title?></h1> | |
| 26 | + </div> | |
| 27 | + </div> | |
| 28 | + <div class="row"> | |
| 29 | + <div class="col-xs-12 service-text-table-wrapp editor-text"> | |
| 30 | + <?=$model->body?> | |
| 31 | + </div> | |
| 32 | + </div> | |
| 33 | + </div> | |
| 34 | + </div> | |
| 35 | + </div> | |
| 36 | +</section> | |
| 37 | +<?php if (!empty($model->comments) or !empty($model->questions)){?> | |
| 38 | +<section class="section-comments-answers fix-map-margin"> | |
| 39 | + <div class="container"> | |
| 40 | + <div class="row"> | |
| 41 | + <?php if (!empty($model->comments)){?> | |
| 42 | + <div class="col-xs-12 col-sm-4 col-md-4"> | |
| 43 | + <div class="title-c-a">Отзывы</div> | |
| 44 | + <div class="service-comments-wr style"> | |
| 45 | + <?php foreach ($model->comments as $comment){?> | |
| 46 | + <div class="service-comments style"> | |
| 47 | + <div class="style comments-h-autor"><?=$comment->name?></div> | |
| 48 | + <div class="style comments-h-text"><?=$comment->comment?></div> | |
| 49 | + <div class="style comments-h-date"><?=date('d.m.Y', $comment->created_at)?></div> | |
| 50 | + </div> | |
| 51 | + <?php }?> | |
| 52 | + </div> | |
| 53 | + | |
| 54 | + <div class="service-links-c-a">Все отзывы</div> | |
| 55 | + <div class="service-c-a-btns"> | |
| 56 | + <span class="btn_">Оставить отзыв</span> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 59 | + <?php }?> | |
| 60 | + <div class="hidden-xs col-sm-1"></div> | |
| 61 | + <div class="col-xs-12 col-sm-7 col-md-7"> | |
| 62 | + <div class="title-c-a">Вопрос-ответ</div> | |
| 63 | + </div> | |
| 64 | + </div> | |
| 65 | + </div> | |
| 66 | +</section> | |
| 67 | +<?php } ?> | |
| 0 | 68 | \ No newline at end of file | ... | ... |
| 1 | +<?php | |
| 2 | + /** | |
| 3 | + * @var \yii\web\View $this; | |
| 4 | + * @var \common\models\Service[] $services; | |
| 5 | + */ | |
| 6 | + $this->params['breadcrumbs'][] = \Yii::t('app', 'Цены'); | |
| 7 | + ?> | |
| 8 | + | |
| 9 | + | |
| 10 | +<section class="section-price"> | |
| 11 | + <div class="container"> | |
| 12 | + <div class="row"> | |
| 13 | + <div class="col-xs-12"> | |
| 14 | +<!-- <h1 class="title-pages">Цены на услуги медицинской клиники ABClinik</h1>--> | |
| 15 | + <div class="title-pages">Цены на услуги медицинской клиники ABClinik</div> | |
| 16 | + </div> | |
| 17 | + </div> | |
| 18 | + <div class="row"> | |
| 19 | + <div class="col-xs-12"> | |
| 20 | + <div class="price-bl-wrapp acordion-bl-wr"> | |
| 21 | + <?php foreach ($services as $service) {?> | |
| 22 | + <div class="acordion-wr service-tb-wrapp"> | |
| 23 | + <span class="acordion-ico"></span> | |
| 24 | + <div class="service-title-wr"> | |
| 25 | + <div class="service-title"><?=$service->title?></div> | |
| 26 | + </div> | |
| 27 | + <table cellpadding="0" cellspacing="0" border="0"> | |
| 28 | +<!-- <tr>--> | |
| 29 | +<!-- <th colspan="2">Прием специалистов</th>--> | |
| 30 | +<!-- </tr>--> | |
| 31 | + <?php foreach ($service->prices as $price){?> | |
| 32 | + <tr> | |
| 33 | + <td><?=$price->title?></td> | |
| 34 | + <td><?=$price->price?> <span>грн.</span></td> | |
| 35 | + </tr> | |
| 36 | + <?php } ?> | |
| 37 | + </table> | |
| 38 | + </div> | |
| 39 | + <?php }?> | |
| 40 | + | |
| 41 | + </div> | |
| 42 | + </div> | |
| 43 | + </div> | |
| 44 | + </div> | |
| 45 | +</section> | |
| 0 | 46 | \ No newline at end of file | ... | ... |