Commit df88ecc9171f8681b0c41cccaa2acf54667fa795

Authored by Anastasia
1 parent 972695e3

- index package

bug fix
frontend/controllers/BlogController.php
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 ->where(['status' => true]) 30 ->where(['status' => true])
31 ->orderBy([ 'sort' => SORT_ASC ]) 31 ->orderBy([ 'sort' => SORT_ASC ])
32 ->all(); 32 ->all();
33 - $data = ArrayHelper::map($categories, 'id', 'language.title'); 33 + $data = ArrayHelper::map($categories, 'language.alias.value', 'language.title');
34 $dataProvider = new ActiveDataProvider( 34 $dataProvider = new ActiveDataProvider(
35 [ 35 [
36 'query' => Article::find() 36 'query' => Article::find()
@@ -87,14 +87,16 @@ @@ -87,14 +87,16 @@
87 87
88 public function actionCategory($id) 88 public function actionCategory($id)
89 { 89 {
90 - $tags = Tag::find()  
91 - ->with(  
92 - [  
93 - 'language',  
94 - ]  
95 - )  
96 - ->orderBy([ 'sort' => SORT_ASC ])  
97 - ->all(); 90 + $categories = Category::find()
  91 + ->with(
  92 + [
  93 + 'language',
  94 + ]
  95 + )
  96 + ->where(['status' => true])
  97 + ->orderBy([ 'sort' => SORT_ASC ])
  98 + ->all();
  99 + $data = ArrayHelper::map($categories, 'language.alias.value', 'language.title');
98 100
99 /** 101 /**
100 * @var Category $model 102 * @var Category $model
@@ -138,23 +140,25 @@ @@ -138,23 +140,25 @@
138 return $this->render( 140 return $this->render(
139 'category', 141 'category',
140 [ 142 [
141 - 'tags' => $tags,  
142 'dataProvider' => $dataProvider, 143 'dataProvider' => $dataProvider,
143 'model' => $model, 144 'model' => $model,
  145 + 'categories' => $data
144 ] 146 ]
145 ); 147 );
146 } 148 }
147 149
148 public function actionTag($id) 150 public function actionTag($id)
149 { 151 {
150 - $tags = Tag::find()  
151 - ->with(  
152 - [  
153 - 'language',  
154 - ]  
155 - )  
156 - ->orderBy([ 'sort' => SORT_ASC ])  
157 - ->all(); 152 + $categories = Category::find()
  153 + ->with(
  154 + [
  155 + 'language',
  156 + ]
  157 + )
  158 + ->where(['status' => true])
  159 + ->orderBy([ 'sort' => SORT_ASC ])
  160 + ->all();
  161 + $data = ArrayHelper::map($categories, 'language.alias.value', 'language.title');
158 162
159 /** 163 /**
160 * @var Category $model 164 * @var Category $model
@@ -196,9 +200,9 @@ @@ -196,9 +200,9 @@
196 return $this->render( 200 return $this->render(
197 'tag', 201 'tag',
198 [ 202 [
199 - 'tags' => $tags,  
200 'dataProvider' => $dataProvider, 203 'dataProvider' => $dataProvider,
201 'model' => $model, 204 'model' => $model,
  205 + 'categories' => $data
202 ] 206 ]
203 ); 207 );
204 } 208 }
frontend/controllers/PackageController.php
@@ -23,11 +23,11 @@ @@ -23,11 +23,11 @@
23 } 23 }
24 24
25 public function actionIndex(){ 25 public function actionIndex(){
26 - $dataProvider = new ActiveDataProvider([  
27 - 'query' => Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')  
28 - ]); 26 +
  27 + $packages = Package::find()->with(['language.alias'])->where(['status' => true])->orderBy('sort')->all();
  28 +
29 return $this->render('index', [ 29 return $this->render('index', [
30 - 'dataProvider' => $dataProvider 30 + 'packages' => $packages
31 ]); 31 ]);
32 } 32 }
33 } 33 }
34 \ No newline at end of file 34 \ No newline at end of file
frontend/views/blog/category.php
1 <?php 1 <?php
2 2
3 use artbox\core\components\SeoComponent; 3 use artbox\core\components\SeoComponent;
4 - use frontend\widgets\BlogSearch;  
5 - use yii\data\ActiveDataProvider;  
6 use artbox\core\helpers\Url; 4 use artbox\core\helpers\Url;
  5 + use yii\data\ActiveDataProvider;
  6 + use yii\helpers\Html;
7 use yii\web\View; 7 use yii\web\View;
  8 + use yii\widgets\ActiveForm;
8 use yii\widgets\ListView; 9 use yii\widgets\ListView;
9 10
10 /** 11 /**
@@ -12,103 +13,85 @@ @@ -12,103 +13,85 @@
12 * @var ActiveDataProvider $dataProvider 13 * @var ActiveDataProvider $dataProvider
13 * @var SeoComponent $seo 14 * @var SeoComponent $seo
14 * @var \common\models\blog\Tag[] $tags 15 * @var \common\models\blog\Tag[] $tags
15 - * @var \common\models\blog\Category $model 16 + * @var common\models\blog\Category[] $categories
  17 + * @var \common\models\blog\Category $model;
16 */ 18 */
17 $seo = \Yii::$app->get('seo'); 19 $seo = \Yii::$app->get('seo');
18 20
19 $this->params[ 'breadcrumbs' ][] = [ 21 $this->params[ 'breadcrumbs' ][] = [
20 - 'label' => \Yii::t('app', 'Блог'),  
21 - 'url' => [ 'blog/index' ], 22 + 'label' => \Yii::t('app', 'Блог'),
  23 + 'url' => Url::to(['blog/index'])
22 ]; 24 ];
23 -  
24 - $this->params[ 'breadcrumbs' ][] = $seo->title; 25 + $this->params['breadcrumbs'][] = $model->title;
25 26
26 ?> 27 ?>
27 28
28 -<div id="content"> 29 +<section class="blog-all-bg">
29 <div class="container"> 30 <div class="container">
30 <div class="row"> 31 <div class="row">
31 - <!-- *** LEFT COLUMN ***  
32 -_________________________________________________________ -->  
33 -  
34 -  
35 - <!-- <ul class="pager">-->  
36 - <!-- <li class="previous"><a href="#">&larr; Назад</a>-->  
37 - <!-- </li>-->  
38 - <!-- <li class="next disabled"><a href="#">Вперед &rarr;</a>-->  
39 - <!-- </li>-->  
40 - <!-- </ul>-->  
41 -  
42 - <!-- /.col-md-9 -->  
43 -  
44 - 32 + <div class="col-xs-12 col-sm-12">
  33 + <div class="blog-title title-pages">Блог</div>
  34 + </div>
  35 + </div>
  36 + <div class="row">
  37 + <div class="col-xs-12 col-sm-5 col-md-4 col-lg-3">
  38 + <div class="fb-subscribe">
  39 + Подписывайтесь на наши новости
  40 + на канале FACEBOOK
  41 + </div>
  42 + </div>
  43 + </div>
  44 + <div class="row">
  45 + <div class="col-xs-12 col-sm-12">
  46 + <div class="style fb-subscribe-btn">
  47 + <a target="_blank" href="#" class="btn_">Подписаться</a>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </div>
  52 +</section>
  53 +
  54 +<section class="blog-all-section">
  55 + <div class="container">
  56 + <div class="row">
  57 + <div class="col-xs-12 col-sm-12 select-blog-col">
  58 + <div class="select-blog">
  59 + <?php $form = ActiveForm::begin();?>
  60 + <div class="input-wr">
  61 + <?=Html::dropDownList('categories', $model->language->alias->value, ['' => 'Все рубрики']+$categories, [
  62 + 'id' => 'blog-categories'
  63 + ])?>
  64 + </div>
  65 + <?php ActiveForm::end()?>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + <div class="row blog-list-row">
45 <?= ListView::widget( 70 <?= ListView::widget(
46 [ 71 [
47 'dataProvider' => $dataProvider, 72 'dataProvider' => $dataProvider,
48 'itemView' => '_article', 73 'itemView' => '_article',
49 'options' => [ 74 'options' => [
50 - 'class' => 'col-md-9',  
51 - 'id' => 'blog-listing-medium', 75 + 'class' => 'col-xs-12 col-sm-4 col-md-4 blog-list-col',
52 ], 76 ],
53 'layout' => '{items}{pager}', 77 'layout' => '{items}{pager}',
54 ] 78 ]
55 ); ?> 79 ); ?>
56 80
57 -  
58 - <!-- *** LEFT COLUMN END *** -->  
59 -  
60 - <!-- *** RIGHT COLUMN ***  
61 -_________________________________________________________ -->  
62 -  
63 - <div class="col-md-3">  
64 -  
65 - <!-- *** MENUS AND WIDGETS ***  
66 -_________________________________________________________ -->  
67 - <div class="panel panel-default sidebar-menu">  
68 -  
69 - <div class="panel-heading">  
70 - <h3 class="panel-title"><?=\Yii::t('app', 'Blog')?></h3>  
71 - </div>  
72 -  
73 - <div class="panel-body text-widget">  
74 - <p>  
75 - Мы собираем полезные материалы по тематике бытовой техники и электроники  
76 - </p>  
77 -  
78 - </div> 81 + <div class="col-xs-12 col-sm-12">
  82 + <div class="style navi-c-a">
  83 +
  84 + <?php echo \frontend\widgets\FrontendPager::widget(
  85 + [
  86 + 'pagination' => $dataProvider->pagination,
  87 + 'prevPageLabel' => 'previous',
  88 + 'nextPageLabel' => 'next',
  89 + 'maxButtonCount' => 5,
  90 + 'lastPageLabel' => 'last_number',
  91 + ]
  92 + );?>
79 </div> 93 </div>
80 -  
81 - <?= BlogSearch::widget(); ?>  
82 -  
83 - <div class="panel sidebar-menu">  
84 - <div class="panel-heading">  
85 - <h3 class="panel-title">Поиск по тегам</h3>  
86 - </div>  
87 -  
88 - <div class="panel-body">  
89 - <ul class="tag-cloud">  
90 - <?php foreach ($tags as $tag) { ?>  
91 - <li><a href="<?= Url::to(  
92 - [  
93 - 'alias' => $tag->alias  
94 - ]  
95 - ) ?>"><i class="fa fa-tags"></i>&#160<?= $tag->label; ?></a>  
96 - </li>  
97 - <?php } ?>  
98 - </ul>  
99 - </div>  
100 - </div>  
101 -  
102 - <!-- *** MENUS AND FILTERS END *** -->  
103 -  
104 </div> 94 </div>
105 - <!-- /.col-md-3 -->  
106 -  
107 - <!-- *** RIGHT COLUMN END *** -->  
108 -  
109 </div> 95 </div>
110 - <!-- /.row -->  
111 </div> 96 </div>
112 - <!-- /.container -->  
113 -</div>  
114 -<!-- /#content -->  
115 \ No newline at end of file 97 \ No newline at end of file
  98 +</section>
116 \ No newline at end of file 99 \ No newline at end of file
frontend/views/blog/index.php
@@ -52,7 +52,9 @@ @@ -52,7 +52,9 @@
52 <div class="select-blog"> 52 <div class="select-blog">
53 <?php $form = ActiveForm::begin();?> 53 <?php $form = ActiveForm::begin();?>
54 <div class="input-wr"> 54 <div class="input-wr">
55 - <?=Html::dropDownList('categories', null, ['' => 'Все рубрики']+$categories)?> 55 + <?=Html::dropDownList('categories', null, ['' => 'Все рубрики']+$categories, [
  56 + 'id' => 'blog-categories'
  57 + ])?>
56 </div> 58 </div>
57 <?php ActiveForm::end()?> 59 <?php ActiveForm::end()?>
58 </div> 60 </div>
frontend/views/blog/tag.php
1 <?php 1 <?php
2 2
3 use artbox\core\components\SeoComponent; 3 use artbox\core\components\SeoComponent;
4 - use common\models\blog\Tag;  
5 - use frontend\widgets\BlogSearch;  
6 - use yii\data\ActiveDataProvider;  
7 use artbox\core\helpers\Url; 4 use artbox\core\helpers\Url;
  5 + use yii\data\ActiveDataProvider;
  6 + use yii\helpers\Html;
8 use yii\web\View; 7 use yii\web\View;
  8 + use yii\widgets\ActiveForm;
9 use yii\widgets\ListView; 9 use yii\widgets\ListView;
10 10
11 /** 11 /**
12 * @var View $this 12 * @var View $this
13 * @var ActiveDataProvider $dataProvider 13 * @var ActiveDataProvider $dataProvider
14 * @var SeoComponent $seo 14 * @var SeoComponent $seo
15 - * @var Tag[] $tags  
16 - * @var Tag $model 15 + * @var \common\models\blog\Tag[] $tags
  16 + * @var common\models\blog\Category[] $categories
  17 + * @var \common\models\blog\Tag $model
17 */ 18 */
18 $seo = \Yii::$app->get('seo'); 19 $seo = \Yii::$app->get('seo');
19 20
20 $this->params[ 'breadcrumbs' ][] = [ 21 $this->params[ 'breadcrumbs' ][] = [
21 'label' => \Yii::t('app', 'Блог'), 22 'label' => \Yii::t('app', 'Блог'),
22 - 'url' => [ 'blog/index' ], 23 + 'url' => Url::to(['blog/index'])
23 ]; 24 ];
24 -  
25 - $this->params[ 'breadcrumbs' ][] = $seo->title; 25 + $this->params['breadcrumbs'][] = $model->title;
26 26
27 ?> 27 ?>
28 28
29 -<div id="content"> 29 +<section class="blog-all-bg">
30 <div class="container"> 30 <div class="container">
31 <div class="row"> 31 <div class="row">
32 - <!-- *** LEFT COLUMN ***  
33 -_________________________________________________________ -->  
34 -  
35 -  
36 - <!-- <ul class="pager">-->  
37 - <!-- <li class="previous"><a href="#">&larr; Назад</a>-->  
38 - <!-- </li>-->  
39 - <!-- <li class="next disabled"><a href="#">Вперед &rarr;</a>-->  
40 - <!-- </li>-->  
41 - <!-- </ul>-->  
42 -  
43 - <!-- /.col-md-9 -->  
44 -  
45 - 32 + <div class="col-xs-12 col-sm-12">
  33 + <div class="blog-title title-pages">Блог</div>
  34 + </div>
  35 + </div>
  36 + <div class="row">
  37 + <div class="col-xs-12 col-sm-5 col-md-4 col-lg-3">
  38 + <div class="fb-subscribe">
  39 + Подписывайтесь на наши новости
  40 + на канале FACEBOOK
  41 + </div>
  42 + </div>
  43 + </div>
  44 + <div class="row">
  45 + <div class="col-xs-12 col-sm-12">
  46 + <div class="style fb-subscribe-btn">
  47 + <a target="_blank" href="#" class="btn_">Подписаться</a>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </div>
  52 +</section>
  53 +
  54 +<section class="blog-all-section">
  55 + <div class="container">
  56 + <div class="row">
  57 + <div class="col-xs-12 col-sm-12 select-blog-col">
  58 + <div class="select-blog">
  59 + <?php $form = ActiveForm::begin();?>
  60 + <div class="input-wr">
  61 + <?=Html::dropDownList('categories', null, ['' => 'Все рубрики']+$categories, [
  62 + 'id' => 'blog-categories'
  63 + ])?>
  64 + </div>
  65 + <?php ActiveForm::end()?>
  66 + </div>
  67 + </div>
  68 + </div>
  69 + <div class="row blog-list-row">
46 <?= ListView::widget( 70 <?= ListView::widget(
47 [ 71 [
48 'dataProvider' => $dataProvider, 72 'dataProvider' => $dataProvider,
49 'itemView' => '_article', 73 'itemView' => '_article',
50 'options' => [ 74 'options' => [
51 - 'class' => 'col-md-9',  
52 - 'id' => 'blog-listing-medium', 75 + 'class' => 'col-xs-12 col-sm-4 col-md-4 blog-list-col',
53 ], 76 ],
54 'layout' => '{items}{pager}', 77 'layout' => '{items}{pager}',
55 ] 78 ]
56 ); ?> 79 ); ?>
57 80
58 -  
59 - <!-- *** LEFT COLUMN END *** -->  
60 -  
61 - <!-- *** RIGHT COLUMN ***  
62 -_________________________________________________________ -->  
63 -  
64 - <div class="col-md-3">  
65 -  
66 - <!-- *** MENUS AND WIDGETS ***  
67 -_________________________________________________________ -->  
68 - <div class="panel panel-default sidebar-menu">  
69 -  
70 - <div class="panel-heading">  
71 - <h3 class="panel-title">Блог компании</h3>  
72 - </div>  
73 -  
74 - <div class="panel-body text-widget">  
75 - <p>  
76 - Мы собираем полезные материалы по тематике бытовой техники и электроники  
77 - </p>  
78 -  
79 - </div> 81 + <div class="col-xs-12 col-sm-12">
  82 + <div class="style navi-c-a">
  83 +
  84 + <?php echo \frontend\widgets\FrontendPager::widget(
  85 + [
  86 + 'pagination' => $dataProvider->pagination,
  87 + 'prevPageLabel' => 'previous',
  88 + 'nextPageLabel' => 'next',
  89 + 'maxButtonCount' => 5,
  90 + 'lastPageLabel' => 'last_number',
  91 + ]
  92 + );?>
80 </div> 93 </div>
81 -  
82 - <?= BlogSearch::widget(); ?>  
83 -  
84 - <div class="panel sidebar-menu">  
85 - <div class="panel-heading">  
86 - <h3 class="panel-title">Поиск по тегам</h3>  
87 - </div>  
88 -  
89 - <div class="panel-body">  
90 - <ul class="tag-cloud">  
91 - <?php foreach ($tags as $tag) { ?>  
92 - <li><a href="<?= Url::to(  
93 - [  
94 - 'alias' => $tag->alias  
95 - ]  
96 - ) ?>"><i class="fa fa-tags"></i>&#160<?= $tag->label; ?></a>  
97 - </li>  
98 - <?php } ?>  
99 - </ul>  
100 - </div>  
101 - </div>  
102 -  
103 - <!-- *** MENUS AND FILTERS END *** -->  
104 -  
105 </div> 94 </div>
106 - <!-- /.col-md-3 -->  
107 -  
108 - <!-- *** RIGHT COLUMN END *** -->  
109 -  
110 </div> 95 </div>
111 - <!-- /.row -->  
112 </div> 96 </div>
113 - <!-- /.container -->  
114 -</div>  
115 -<!-- /#content -->  
116 \ No newline at end of file 97 \ No newline at end of file
  98 +</section>
117 \ No newline at end of file 99 \ No newline at end of file
frontend/views/package/index.php
1 <?php 1 <?php
2 /** 2 /**
3 - * @var \yii\data\ActiveDataProvider $dataProvider 3 + * @var \common\models\Package[] $packages
4 * @var \yii\web\View $this 4 * @var \yii\web\View $this
5 */ 5 */
6 6
7 - $this->params['breadcrumbs'][] = \Yii::t('app', 'Пакетные предложения');  
8 - ?>  
9 \ No newline at end of file 7 \ No newline at end of file
  8 + use artbox\core\helpers\ImageHelper;
  9 + use artbox\core\helpers\Url;
  10 +
  11 + $this->params[ 'breadcrumbs'][] = \Yii::t('app', 'Пакетные предложения');
  12 + ?>
  13 +
  14 +<section class="section-packages-page">
  15 + <div class="container">
  16 + <div class="row">
  17 + <div class="col-xs-12">
  18 + <h1 class="title-pages">Пакетные предолжения</h1>
  19 + </div>
  20 + </div>
  21 + <div class="row">
  22 + <?php foreach ($packages as $package){
  23 +// print_r($package->language); die();
  24 +
  25 + ?>
  26 + <div class="col-xs-12 col-sm-6 packages-page-col">
  27 + <a class="packages-page-link" href="<?=Url::to(['alias' => $package->language->alias])?>">
  28 + <div class="img-packages-page">
  29 + <!--555x344-->
  30 + <?=ImageHelper::set(($package->image) ? $package->image->getPath() : null)
  31 + ->cropResize(555, 344)
  32 + ->quality(84)
  33 + ->renderImage()?>
  34 + </div>
  35 + <div class="table-packages-wr">
  36 + <table cellspacing="0" cellpadding="0" border="0">
  37 + <tr>
  38 + <td><span class="title-packages"><?=$package->title?></span></td>
  39 + </tr>
  40 + <tr>
  41 + <td>
  42 + <span class="btn_ packages-btn">подробнее</span>
  43 + </td>
  44 + </tr>
  45 + </table>
  46 + </div>
  47 + </a>
  48 + </div>
  49 + <?php }?>
  50 + </div>
  51 + </div>
  52 +</section>
frontend/views/site/index.php
@@ -174,7 +174,7 @@ JS; @@ -174,7 +174,7 @@ JS;
174 <?php foreach ($package as $item){?> 174 <?php foreach ($package as $item){?>
175 <div class="col-xs-12 col-sm-4 package-offers-wr"> 175 <div class="col-xs-12 col-sm-4 package-offers-wr">
176 <a href="<?=Url::to(['alias' => $item->alias])?>"> 176 <a href="<?=Url::to(['alias' => $item->alias])?>">
177 - <div class="img"><?=ImageHelper::set($item->image->getPath()) 177 + <div class="img"><?=ImageHelper::set(($item->image) ? $item->image->getPath() : null)
178 ->cropResize(388, 240) 178 ->cropResize(388, 240)
179 ->quality(84) 179 ->quality(84)
180 ->renderImage()?></div> 180 ->renderImage()?></div>
frontend/web/js/script.js
@@ -459,7 +459,14 @@ $(document).ready(function() { @@ -459,7 +459,14 @@ $(document).ready(function() {
459 }); 459 });
460 }); 460 });
461 461
462 - 462 + $(document).on('change', '#blog-categories', function(e) {
  463 + var value = $(this).val();
  464 + if (value !== ''){
  465 + window.location.href = value;
  466 + }else{
  467 + window.location.href = 'blog/index';
  468 + }
  469 + });
463 470
464 }); 471 });
465 472
@@ -495,4 +502,5 @@ window.onload = function () { @@ -495,4 +502,5 @@ window.onload = function () {
495 $(window).load(function() { 502 $(window).load(function() {
496 console.log('start load jquery'); 503 console.log('start load jquery');
497 504
498 -});  
499 \ No newline at end of file 505 \ No newline at end of file
  506 +});
  507 +