Commit f2acc39351b2aa2c4102b83c5754a07b3bc54b15

Authored by Alexey Boroda
1 parent 1e21ad02

-Seo widget integration

backend/views/blog-category/_form.php
... ... @@ -13,7 +13,16 @@ use yii\widgets\ActiveForm;
13 13 <?php $form = ActiveForm::begin(); ?>
14 14  
15 15 <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
16   -
  16 +
  17 + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?>
  18 +
  19 + <?= $form->field($model, 'meta_desc')->textInput(['maxlength' => true]) ?>
  20 +
  21 + <?= $form->field($model, 'seo_text')->textInput(['maxlength' => true]) ?>
  22 +
  23 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  24 +
  25 +
17 26 <div class="form-group">
18 27 <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
19 28 </div>
... ...
common/models/BlogCategory.php
... ... @@ -8,6 +8,12 @@
8 8 * Class BlogCategory
9 9 * @package common\models
10 10 * @property Blog[] $blogs
  11 + * @property string $name
  12 + * @property integer $id
  13 + * @property string $meta_title
  14 + * @property string $meta_desc
  15 + * @property string $seo_text
  16 + * @property string $h1
11 17 */
12 18 class BlogCategory extends ActiveRecord
13 19 {
... ... @@ -20,7 +26,13 @@
20 26 {
21 27 return [
22 28 [
23   - [ 'name' ],
  29 + [
  30 + 'name',
  31 + 'meta_title',
  32 + 'meta_desc',
  33 + 'seo_text',
  34 + 'h1',
  35 + ],
24 36 'string',
25 37 ],
26 38 ];
... ...
console/migrations/m161021_094522_seo_to_blog_migration.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +class m161021_094522_seo_to_blog_migration extends Migration
  6 +{
  7 + public function up()
  8 + {
  9 + $this->addColumn('blog_category', 'meta_title', $this->string(255));
  10 + $this->addColumn('blog_category', 'meta_desc', $this->string(255));
  11 + $this->addColumn('blog_category', 'seo_text', $this->string(255));
  12 + $this->addColumn('blog_category', 'h1', $this->string(255));
  13 + }
  14 +
  15 + public function down()
  16 + {
  17 + $this->dropColumn('blog_category', 'h1');
  18 + $this->dropColumn('blog_category', 'seo_text');
  19 + $this->dropColumn('blog_category', 'meta_desc');
  20 + $this->dropColumn('blog_category', 'meta_title');
  21 + }
  22 +}
... ...
frontend/views/article/index.php
1 1 <?php
2   -
3   -use common\modules\product\models\Category;
4   -use yii\data\ActiveDataProvider;
5   -use yii\web\View;
6   -use yii\widgets\ListView;
7   -
8   -/**
9   - * @var Category $category
10   - * @var ActiveDataProvider $dataProvider
11   - * @var View $this
12   - */
13   -$this->title = "События";
14   -$this->params[ 'breadcrumbs' ][] = $this->title;
  2 +
  3 + use common\modules\product\models\Category;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\web\View;
  6 + use yii\widgets\ListView;
  7 + use common\widgets\Seo;
  8 +
  9 + /**
  10 + * @var Category $category
  11 + * @var ActiveDataProvider $dataProvider
  12 + * @var View $this
  13 + */
  14 + $this->params[ 'seo' ][ Seo::TITLE ] = "События";
  15 + $this->params[ 'breadcrumbs' ][] = 'События';
15 16  
16 17 ?>
17 18  
18 19 <div class="col-md-12">
19   -
20   -
  20 +
  21 +
21 22 <?php
22   - echo ListView::widget([
23   - 'dataProvider' => $dataProvider,
24   - 'options' => [
25   - 'tag' => false,
26   - ],
27   - 'pager' => [
28   - 'prevPageCssClass' => 'left_pg',
29   - 'nextPageCssClass' => 'right_pg',
30   - 'activePageCssClass' => 'active',
31   - 'disabledPageCssClass' => '',
32   - 'firstPageLabel' => false,
33   -// 'nextPageLabel' =>
34   - ],
35   - 'itemView' => '_article_item',
36   - 'layout' => '{items}{pager}',
37   - ]);
  23 + echo ListView::widget([
  24 + 'dataProvider' => $dataProvider,
  25 + 'options' => [
  26 + 'tag' => false,
  27 + ],
  28 + 'pager' => [
  29 + 'prevPageCssClass' => 'left_pg',
  30 + 'nextPageCssClass' => 'right_pg',
  31 + 'activePageCssClass' => 'active',
  32 + 'disabledPageCssClass' => '',
  33 + 'firstPageLabel' => false,
  34 + // 'nextPageLabel' =>
  35 + ],
  36 + 'itemView' => '_article_item',
  37 + 'layout' => '{items}{pager}',
  38 + ]);
38 39 ?>
39   -
40   -<!-- <ul class="pages">-->
41   -<!-- <li><a href="#" class="left_pg"></a></li>-->
42   -<!-- <li><a href="#" class="active">1</a></li>-->
43   -<!-- <li><a href="#">2</a></li>-->
44   -<!-- <li><a href="#">3</a></li>-->
45   -<!-- <li><a href="#" class="right_pg"></a></li>-->
46   -<!-- </ul>-->
  40 +
  41 + <!-- <ul class="pages">-->
  42 + <!-- <li><a href="#" class="left_pg"></a></li>-->
  43 + <!-- <li><a href="#" class="active">1</a></li>-->
  44 + <!-- <li><a href="#">2</a></li>-->
  45 + <!-- <li><a href="#">3</a></li>-->
  46 + <!-- <li><a href="#" class="right_pg"></a></li>-->
  47 + <!-- </ul>-->
47 48 </div>
... ...
frontend/views/article/view.php
1 1 <?php
2   -
3   -/**
4   - * @var Articles $model
5   - * @var View $this
6   - */
7   -use common\models\Articles;
8   -use yii\web\View;
9   -use yii\helpers\Url;
10   -
11   -$this->title = $model->title;
12   -$this->params[ 'breadcrumbs' ][] = [
13   - 'label' => "События",
14   - 'url' => Url::to(['article/index']),
15   -];
16   -$this->params[ 'breadcrumbs' ][] = $this->title;
  2 +
  3 + /**
  4 + * @var Articles $model
  5 + * @var View $this
  6 + */
  7 + use common\models\Articles;
  8 + use yii\web\View;
  9 + use yii\helpers\Url;
  10 + use common\widgets\Seo;
  11 +
  12 + $this->params[ 'seo' ][ Seo::TITLE ] = $model->title;
  13 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = '';
  14 + $this->params[ 'breadcrumbs' ][] = [
  15 + 'label' => "События",
  16 + 'url' => Url::to([ 'article/index' ]),
  17 + ];
  18 + $this->params[ 'breadcrumbs' ][] = $model->title;
17 19 ?>
18 20  
19 21 <div class="col-md-12 blog_post1">
... ...
frontend/views/blog/category.php
... ... @@ -5,20 +5,22 @@
5 5 use yii\helpers\Url;
6 6 use yii\web\View;
7 7 use yii\widgets\ListView;
  8 + use common\widgets\Seo;
8 9  
9 10 /**
10 11 * @var BlogCategory $model
11 12 * @var ActiveDataProvider $dataProvider
12 13 * @var View $this
13 14 */
14   - $this->title = $model->name;
  15 + $this->params['seo'][Seo::TITLE] = !empty($model->meta_title) ? $model->meta_title : $model->name;
  16 + $this->params['seo'][Seo::DESCRIPTION] = !empty($model->meta_desc) ? $model->meta_desc : '';
15 17 $this->params[ 'breadcrumbs' ][] = [
16 18 'label' => 'Блог',
17 19 'url' => Url::to([
18 20 '/blog'
19 21 ]),
20 22 ];
21   - $this->params[ 'breadcrumbs' ][] = $this->title;
  23 + $this->params[ 'breadcrumbs' ][] = $model->name;
22 24 ?>
23 25  
24 26 <div class="col-md-12">
... ...
frontend/views/blog/index.php
1 1 <?php
2   -
3   -use common\modules\product\models\Category;
4   -use yii\data\ActiveDataProvider;
5   -use yii\web\View;
6   -use yii\widgets\ListView;
7   -
8   -/**
9   - * @var Category $category
10   - * @var ActiveDataProvider $dataProvider
11   - * @var View $this
12   - */
13   -$this->title = "Блог";
14   -$this->params[ 'breadcrumbs' ][] = $this->title;
  2 +
  3 + use common\modules\product\models\Category;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\web\View;
  6 + use yii\widgets\ListView;
  7 + use common\widgets\Seo;
  8 +
  9 + /**
  10 + * @var Category $category
  11 + * @var ActiveDataProvider $dataProvider
  12 + * @var View $this
  13 + */
  14 + $this->params[ 'seo' ][ Seo::TITLE ] = "Блог";
  15 + $this->params[ 'breadcrumbs' ][] = 'Блог';
15 16  
16 17 ?>
17 18  
18 19 <div class="col-md-12">
19 20 <?php
20   -
21   - echo ListView::widget([
22   - 'dataProvider' => $dataProvider,
23   - 'options' => [
24   - 'tag' => false,
25   - ],
26   - 'pager' => [
27   - 'prevPageCssClass' => 'left_pg',
28   - 'nextPageCssClass' => 'right_pg',
29   - 'activePageCssClass' => 'active',
30   - 'disabledPageCssClass' => '',
31   - 'firstPageLabel' => false,
32   -// 'nextPageLabel' =>
33   - ],
34   - 'itemView' => '_blog_item',
35   - 'layout' => '{items}{pager}',
36   - ]);
37   -
  21 +
  22 + echo ListView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'options' => [
  25 + 'tag' => false,
  26 + ],
  27 + 'pager' => [
  28 + 'prevPageCssClass' => 'left_pg',
  29 + 'nextPageCssClass' => 'right_pg',
  30 + 'activePageCssClass' => 'active',
  31 + 'disabledPageCssClass' => '',
  32 + 'firstPageLabel' => false,
  33 + // 'nextPageLabel' =>
  34 + ],
  35 + 'itemView' => '_blog_item',
  36 + 'layout' => '{items}{pager}',
  37 + ]);
  38 +
38 39 ?>
39 40 </div>
... ...
frontend/views/blog/view.php
... ... @@ -9,14 +9,16 @@
9 9 use common\modules\comment\widgets\CommentWidget;
10 10 use yii\helpers\Url;
11 11 use yii\web\View;
  12 + use common\widgets\Seo;
12 13  
13 14 $this->title = $model->title;
14   -
  15 + $this->params[ 'seo' ][ Seo::TITLE ] = $model->title;
  16 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = '';
15 17 $this->params[ 'breadcrumbs' ][] = [
16 18 'label' => 'Блог',
17 19 'url' => Url::to([ '/blog' ]),
18 20 ];
19   - $this->params[ 'breadcrumbs' ][] = $this->title;
  21 + $this->params[ 'breadcrumbs' ][] = $model->title;
20 22  
21 23 ?>
22 24  
... ...
frontend/views/catalog/_product_list.php
... ... @@ -22,9 +22,6 @@ use yii\widgets\ListView;
22 22 'variant' => $model->variant->sku,
23 23 ])?>">
24 24 <div class="picture" style="background-image:url('<?php echo ArtboxImageHelper::getImageSrc($model->getImageUrl(), 'product_list_item'); ?>');"></div>
25   - <?php
26   -// echo ArtboxImageHelper::getLazyDiv($model->getImageUrl(), 'product_list_item', ['class' => 'picture']);
27   - ?>
28 25 <div class="title_1"><?php echo $model->name; ?></div>
29 26 <div class="title_2"><?php echo $model->variant->sku; ?></div>
30 27 </a>
... ...
frontend/views/catalog/products.php
1 1 <?php
2   -
3   -/**
4   - * @var ActiveDataProvider $dataProvider
5   - * @var View $this
6   - * @var ActiveDataProvider $productsProvider
7   - * @var Category $category
8   - * @var Category[] $stockProgram
9   - * @var Category[] $onOrder
10   - */
11   -use common\modules\product\models\Category;
12   -use yii\data\ActiveDataProvider;
13   -use yii\helpers\Url;
14   -use yii\web\View;
15   -use yii\widgets\ListView;
16   -use frontend\widgets\FilterWidget;
17   -$this->title = $category->first_text;
18   -$this->params['breadcrumbs'][] = $this->title;
  2 +
  3 + /**
  4 + * @var ActiveDataProvider $dataProvider
  5 + * @var View $this
  6 + * @var ActiveDataProvider $productsProvider
  7 + * @var Category $category
  8 + * @var Category[] $stockProgram
  9 + * @var Category[] $onOrder
  10 + */
  11 + use common\modules\product\models\Category;
  12 + use yii\data\ActiveDataProvider;
  13 + use yii\helpers\Url;
  14 + use yii\web\View;
  15 + use yii\widgets\ListView;
  16 + use frontend\widgets\FilterWidget;
  17 + use common\widgets\Seo;
  18 +
  19 + $this->params[ 'seo' ][ Seo::TITLE ] = $category->first_text;
  20 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = '';
  21 + $this->params[ 'breadcrumbs' ][] = $category->first_text;
19 22  
20 23 ?>
21 24 <div class="col-md-12">
22 25 <div class="catalog_block">
23   - <div class="col-md-3 filters">
24   - <div class="button1"><a href="<?php
25   - echo Url::to(['/discount']);
26   - ?>" class="punkt">Акции / Скидки</a></div>
27   - <div class="filters_block">
28   - <div class="button2">
29   - <a href="#" class="punkt">Складская программа</a>
30   - <div class="spoiler">
31   - <ul>
32   - <?php
33   - foreach ($stockProgram as $brand) {
34   - ?>
35   - <li><a href="<?php
36   - echo Url::to([
37   - 'category/brand',
38   - 'id' => $brand->category_id,
39   - ]);
40   - ?>"><?php echo $brand->name;?> <span>/ <?php echo $brand->meta_desc;?></span></a></li>
41   - <?php } ?>
42   - </ul>
  26 + <div class="col-md-3 filters">
  27 + <div class="button1"><a href="<?php
  28 + echo Url::to([ '/discount' ]);
  29 + ?>" class="punkt">Акции / Скидки</a></div>
  30 + <div class="filters_block">
  31 + <div class="button2">
  32 + <a href="#" class="punkt">Складская программа</a>
  33 + <div class="spoiler">
  34 + <ul>
  35 + <?php
  36 + foreach($stockProgram as $brand) {
  37 + ?>
  38 + <li><a href="<?php
  39 + echo Url::to([
  40 + 'category/brand',
  41 + 'id' => $brand->category_id,
  42 + ]);
  43 + ?>"><?php echo $brand->name; ?>
  44 + <span>/ <?php echo $brand->meta_desc; ?></span></a></li>
  45 + <?php } ?>
  46 + </ul>
  47 + </div>
43 48 </div>
44   - </div>
45   - <div class="button2">
46   - <a href="#" class="punkt">Под заказ</a>
47   - <div class="spoiler">
48   - <ul>
49   - <?php
50   - foreach ($onOrder as $brand) {
51   - ?>
52   - <li><a href="<?php
53   - echo Url::to([
54   - 'category/brand',
55   - 'id' => $brand->category_id,
56   - ]);
57   - ?>"><?php echo $brand->name;?> <span>/ <?php echo $brand->meta_desc;?></span></a></li>
58   - <?php } ?>
59   - </ul>
  49 + <div class="button2">
  50 + <a href="#" class="punkt">Под заказ</a>
  51 + <div class="spoiler">
  52 + <ul>
  53 + <?php
  54 + foreach($onOrder as $brand) {
  55 + ?>
  56 + <li><a href="<?php
  57 + echo Url::to([
  58 + 'category/brand',
  59 + 'id' => $brand->category_id,
  60 + ]);
  61 + ?>"><?php echo $brand->name; ?>
  62 + <span>/ <?php echo $brand->meta_desc; ?></span></a></li>
  63 + <?php } ?>
  64 + </ul>
  65 + </div>
60 66 </div>
  67 + <div class="title">Фильтры</div>
  68 + <form method="post" action="/site/sku">
  69 + <div><input name="sku" type="text" placeholder="Артикул"></div>
  70 + </form>
  71 + <?= FilterWidget::widget([
  72 + 'category' => $category,
  73 + 'groups' => $groups,
  74 + 'filter' => $filter,
  75 + ]) ?>
61 76 </div>
62   - <div class="title">Фильтры</div>
63   - <form method="post" action="/site/sku">
64   - <div><input name="sku" type="text" placeholder="Артикул"></div>
65   - </form>
66   - <?= FilterWidget::widget([
67   - 'category'=>$category,
68   - 'groups'=> $groups,
69   - 'filter'=> $filter,
70   - ])?>
71 77 </div>
72   - </div>
73   - <div class="col-md-9">
74   - <div class="blocks_2">
75   -
76   - <?php echo ListView::widget([
77   - 'dataProvider' => $productsProvider,
78   - 'itemView' => '_product_list',
79   - 'layout' => '{items}{pager}',
80   - ])?>
81   -
  78 + <div class="col-md-9">
  79 + <div class="blocks_2">
  80 +
  81 + <?php echo ListView::widget([
  82 + 'dataProvider' => $productsProvider,
  83 + 'itemView' => '_product_list',
  84 + 'layout' => '{items}{pager}',
  85 + ]) ?>
  86 +
  87 + </div>
82 88 </div>
83 89 </div>
84   - </div>
85 90 </div>
86 91 <div class="textile_bottom">
87   - <div class="title1 left">Стильные элитные обои для вашего дома.</div>
  92 + <h1 class="title1 left"><?php echo Seo::widget(['row' => Seo::H1]); ?></h1>
88 93 <div class="simple-spoiler just-closed" style="height: 50px">
89   - <div class="spoiler-inner">Продумывая дизайн своей квартиры, мы непременно тщательно выбираем «одежду» для стен — красивые модные обои.</div>
  94 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]); ?></div>
90 95 </div>
91 96 <div class="just-more">
92 97 <a href="#">Узнать больше</a>
... ...
frontend/views/catalog/view.php
1 1 <?php
2   -/**
3   - * @var Product $product
4   - * @var ProductVariant $variant
5   - * @var View $this
6   - * @var ProductVariant[] $variants
7   - * @var array $attributes
8   - */
9   -use common\components\artboximage\ArtboxImageHelper;
10   -use common\modules\product\models\Product;
11   -use common\modules\product\models\ProductVariant;
12   -use yii\helpers\Html;
13   -use yii\helpers\Url;
14   -use yii\web\View;
15   -use yii\widgets\Pjax;
16   -
17   -$this->title = $product->name;
18   -$this->params['breadcrumbs'][] = [
19   - 'label' => $product->category->parent->parent->name,
20   - 'url' => Url::to([
21   - 'category/index',
22   - 'id' => $product->category->parent->parent->category_id,
23   - ]),
24   -];
25   -$this->params['breadcrumbs'][] = [
26   - 'label' => $product->category->parent->name,
27   - 'url' => Url::to([
28   - 'category/brand',
29   - 'id' => $product->category->parent->category_id,
30   - ]),
31   -];
32   -$this->params['breadcrumbs'][] = [
33   - 'label' => $product->category->name,
34   - 'url' => Url::to([
35   - 'category/collection',
36   - 'id' => $product->category->category_id,
37   - ]),
38   -];
39   -$this->params['breadcrumbs'][] = $this->title;
  2 + /**
  3 + * @var Product $product
  4 + * @var ProductVariant $variant
  5 + * @var View $this
  6 + * @var ProductVariant[] $variants
  7 + * @var array $attributes
  8 + */
  9 + use common\components\artboximage\ArtboxImageHelper;
  10 + use common\modules\product\models\Product;
  11 + use common\modules\product\models\ProductVariant;
  12 + use yii\helpers\Html;
  13 + use yii\helpers\Url;
  14 + use yii\web\View;
  15 + use yii\widgets\Pjax;
  16 + use common\widgets\Seo;
  17 +
  18 + $this->title = $product->name;
  19 + $this->params[ 'breadcrumbs' ][] = [
  20 + 'label' => $product->category->parent->parent->name,
  21 + 'url' => Url::to([
  22 + 'category/index',
  23 + 'id' => $product->category->parent->parent->category_id,
  24 + ]),
  25 + ];
  26 + $this->params[ 'breadcrumbs' ][] = [
  27 + 'label' => $product->category->parent->name,
  28 + 'url' => Url::to([
  29 + 'category/brand',
  30 + 'id' => $product->category->parent->category_id,
  31 + ]),
  32 + ];
  33 + $this->params[ 'breadcrumbs' ][] = [
  34 + 'label' => $product->category->name,
  35 + 'url' => Url::to([
  36 + 'category/collection',
  37 + 'id' => $product->category->category_id,
  38 + ]),
  39 + ];
  40 + $this->params[ 'breadcrumbs' ][] = $product->name;
  41 + $this->params[ 'seo' ][ Seo::TITLE ] = $product->name;
40 42  
41 43 ?>
42 44  
43 45 <?php Pjax::begin([
44   - 'id' => 'pjax-reload',
  46 + 'id' => 'pjax-reload',
45 47 'timeout' => 5000,
46 48 ]); ?>
47 49 <div class="col-md-12 product">
48 50 <div class="col-md-8 col-sm-12">
49 51 <div class="pic">
50 52 <?php
51   - echo ArtboxImageHelper::getImage($variant->getImageUrl(), 'product_main');
  53 + echo ArtboxImageHelper::getImage($variant->getImageUrl(), 'product_main');
52 54 ?>
53 55 </div>
54 56 </div>
... ... @@ -56,14 +58,16 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
56 58 <div class="name1"><?php echo $product->name; ?></div>
57 59 <div class="name2"><?php echo $product->category->name; ?></div>
58 60 <div class="name3"><?php echo $product->category->parent->name; ?></div>
59   -
  61 +
60 62 <ul>
61 63 <li><span>Артикул:</span> <?php echo $variant->sku; ?></li>
62 64 <?php
63   - if(!empty($attributes)) {
64   - foreach($attributes as $group => $options) { ?>
65   - <li><span><?php echo $group; ?>:</span> <?php echo implode(', ', $options); ?></li>
66   - <?php }
  65 + if(!empty( $attributes )) {
  66 + foreach($attributes as $group => $options) { ?>
  67 + <li>
  68 + <span><?php echo $group; ?>:</span> <?php echo implode(', ', $options); ?>
  69 + </li>
  70 + <?php }
67 71 }
68 72 ?>
69 73 </ul>
... ... @@ -72,17 +76,17 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
72 76 </div>
73 77 <div class="col-md-12 mat_pics">
74 78 <?php
75   - foreach ($variants as $oneVariant) {
76   - ?>
77   - <div class="col-md-2 col-sm-3 col-xs-4 mat_pic">
78   - <?php
79   - echo Html::a(ArtboxImageHelper::getImage($oneVariant->getImageUrl(), 'product_variant_main'), [
80   - 'catalog/product',
81   - 'product' => $product->alias,
82   - 'variant' => $oneVariant->sku,
83   - ]);
84   - ?>
85   - </div>
86   - <?php } ?>
  79 + foreach($variants as $oneVariant) {
  80 + ?>
  81 + <div class="col-md-2 col-sm-3 col-xs-4 mat_pic">
  82 + <?php
  83 + echo Html::a(ArtboxImageHelper::getImage($oneVariant->getImageUrl(), 'product_variant_main'), [
  84 + 'catalog/product',
  85 + 'product' => $product->alias,
  86 + 'variant' => $oneVariant->sku,
  87 + ]);
  88 + ?>
  89 + </div>
  90 + <?php } ?>
87 91 </div>
88 92 <?php Pjax::end(); ?>
... ...
frontend/views/category/brand.php
1 1 <?php
2   -use common\modules\product\models\Category;
3   -use yii\data\ActiveDataProvider;
4   -use yii\web\View;
5   -use yii\widgets\ListView;
6   -
7   -/**
8   - * @var Category $category
9   - * @var ActiveDataProvider $dataProvider
10   - * @var View $this
11   - */
12   -$this->title = $category->name;
13   -$this->params[ 'breadcrumbs' ][] = [
14   - 'label' => $category->parent->name,
15   - 'url' => ['category/index', 'id' => $category->parent->category_id],
16   -];
17   -$this->params[ 'breadcrumbs' ][] = $this->title;
  2 + use common\modules\product\models\Category;
  3 + use yii\data\ActiveDataProvider;
  4 + use yii\web\View;
  5 + use yii\widgets\ListView;
  6 + use common\widgets\Seo;
  7 +
  8 + /**
  9 + * @var Category $category
  10 + * @var ActiveDataProvider $dataProvider
  11 + * @var View $this
  12 + */
  13 + $this->params[ 'seo' ][ Seo::TITLE ] = !empty( $category->meta_title ) ? $category->meta_title : $category->name;
  14 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = !empty( $category->meta_desc ) ? $category->meta_desc : '';
  15 + $this->params[ 'seo' ][ Seo::SEO_TEXT ] = !empty( $category->seo_text ) ? $category->seo_text : '';
  16 + $this->params[ 'seo' ][ Seo::H1 ] = !empty( $category->h1 ) ? $category->h1 : $category->name;
  17 + $this->params[ 'breadcrumbs' ][] = [
  18 + 'label' => $category->parent->name,
  19 + 'url' => [
  20 + 'category/index',
  21 + 'id' => $category->parent->category_id,
  22 + ],
  23 + ];
  24 + $this->params[ 'breadcrumbs' ][] = $category->name;
18 25 ?>
19 26  
20 27  
... ... @@ -24,19 +31,19 @@ $this-&gt;params[ &#39;breadcrumbs&#39; ][] = $this-&gt;title;
24 31 </div>
25 32 <div class="brand_title1"><?php echo $category->first_text; ?></div>
26 33 <div class="brand_title2"><?php echo $category->second_text; ?></div>
27   -
  34 +
28 35 <?php
29   - echo ListView::widget([
30   - 'dataProvider' => $dataProvider,
31   - 'itemView' => '_brand_item',
32   - 'layout' => '{items}',
33   - ])
  36 + echo ListView::widget([
  37 + 'dataProvider' => $dataProvider,
  38 + 'itemView' => '_brand_item',
  39 + 'layout' => '{items}',
  40 + ])
34 41 ?>
35   -
  42 +
36 43 <div class="col-md-12 about_brand">
37   - <div class="title4"><?php echo $category->h1; ?></div>
  44 + <h1 class="title4"><?php echo Seo::widget(['row' => Seo::H1]); ?></h1>
38 45 <div class="simple-spoiler just-closed" style="height: 50px">
39   - <div class="spoiler-inner"><?php echo $category->seo_text; ?></div>
  46 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]); ?></div>
40 47 </div>
41 48 <div class="just-more">
42 49 <a href="#">Узнать больше</a>
... ...
frontend/views/category/collection.php
1 1 <?php
2   -/**
3   - * @var Product[][] $products
4   - * @var View $this
5   - * @var Category $category
6   - */
7   -use common\components\artboximage\ArtboxImageHelper;
8   -use common\modules\product\models\Category;
9   -use common\modules\product\models\Product;
10   -use yii\web\View;
11   -use yii\helpers\Url;
12   -
13   -$this->title = $category->name;
14   -$this->params['breadcrumbs'][] = [
15   - 'label' => $category->parent->parent->name,
16   - 'url' => Url::to([
17   - 'category/index',
18   - 'id' => $category->parent->parent->category_id,
19   - ]),
20   -];
21   -$this->params['breadcrumbs'][] = [
22   - 'label' => $category->parent->name,
23   - 'url' => Url::to([
24   - 'category/brand',
25   - 'id' => $category->parent->category_id,
26   - ]),
27   -];
28   -$this->params['breadcrumbs'][] = $this->title;
  2 + /**
  3 + * @var Product[][] $products
  4 + * @var View $this
  5 + * @var Category $category
  6 + */
  7 + use common\components\artboximage\ArtboxImageHelper;
  8 + use common\modules\product\models\Category;
  9 + use common\modules\product\models\Product;
  10 + use yii\web\View;
  11 + use yii\helpers\Url;
  12 + use common\widgets\Seo;
  13 +
  14 + $this->params[ 'seo' ][ Seo::TITLE ] = !empty( $category->meta_title ) ? $category->meta_title : $category->name;
  15 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = !empty( $category->meta_desc ) ? $category->meta_desc : '';
  16 + $this->params[ 'seo' ][ Seo::SEO_TEXT ] = !empty( $category->seo_text ) ? $category->seo_text : '';
  17 + $this->params[ 'seo' ][ Seo::H1 ] = !empty( $category->h1 ) ? $category->h1 : $category->name;
  18 + $this->params[ 'breadcrumbs' ][] = [
  19 + 'label' => $category->parent->parent->name,
  20 + 'url' => Url::to([
  21 + 'category/index',
  22 + 'id' => $category->parent->parent->category_id,
  23 + ]),
  24 + ];
  25 + $this->params[ 'breadcrumbs' ][] = [
  26 + 'label' => $category->parent->name,
  27 + 'url' => Url::to([
  28 + 'category/brand',
  29 + 'id' => $category->parent->category_id,
  30 + ]),
  31 + ];
  32 + $this->params[ 'breadcrumbs' ][] = $category->name;
29 33 ?>
30 34  
31 35 <div class="col-md-12">
32 36 <div class="collection">
33 37 <div class="head">
34 38 <img src="<?php
35   - echo $category->getBrandImageUrl();
  39 + echo $category->getBrandImageUrl();
36 40 ?>">
37 41 </div>
38 42 <div class="titles">
39 43 <div class="line1"><?php echo $category->name; ?></div>
40 44 <div class="line2"><?php echo $category->first_text; ?></div>
41 45 </div>
42   - <p><?php echo $category->meta_desc; ?></p>
  46 + <p><?php echo $category->second_text; ?></p>
43 47 <div class="cols">
44 48 <?php
45   - foreach ($products as $products_col) {
46   - ?>
47   - <div class="col-md-4 col-sm-4 col1">
48   - <?php
49   - foreach ($products_col as $product) {
50   - ?>
51   - <a href="<?php echo Url::to([
52   - 'catalog/product',
53   - 'product' => $product->alias,
54   - 'variant' => $product->variant->sku,
55   - ]); ?>" alt="nabuco">
56   - <div class="label"><span><?php echo $product->name; ?></span></div>
57   - <?php echo ArtboxImageHelper::getImage($product->getMainImageUrl(), 'collections_thumb');?>
58   - </a>
  49 + foreach($products as $products_col) {
  50 + ?>
  51 + <div class="col-md-4 col-sm-4 col1">
  52 + <?php
  53 + foreach($products_col as $product) {
  54 + ?>
  55 + <a href="<?php echo Url::to([
  56 + 'catalog/product',
  57 + 'product' => $product->alias,
  58 + 'variant' => $product->variant->sku,
  59 + ]); ?>" alt="nabuco">
  60 + <div class="label"><span><?php echo $product->name; ?></span>
  61 + </div>
  62 + <?php echo ArtboxImageHelper::getImage($product->getMainImageUrl(), 'collections_thumb'); ?>
  63 + </a>
  64 + <?php } ?>
  65 + </div>
59 66 <?php } ?>
60   - </div>
61   - <?php } ?>
62 67 <div style="clear:both;"></div>
63 68 </div>
64 69 <div class="down">
65 70 <div class="simple-spoiler just-closed" style="height: 50px">
66   - <div class="spoiler-inner"><?php echo $category->seo_text; ?></div>
  71 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]); ?></div>
67 72 </div>
68 73 <div class="just-more">
69 74 <a href="#">Узнать больше</a>
... ...
frontend/views/category/index.php
1 1 <?php
2   -use common\modules\product\models\Category;
3   -use yii\data\ActiveDataProvider;
4   -use yii\web\View;
5   -use yii\widgets\ListView;
6   -
7   -/**
8   - * @var Category $category
9   - * @var ActiveDataProvider $dataProvider
10   - * @var View $this
11   - */
12   - $this->params[ 'seo' ][ 'title' ] = !empty($category->meta_title) ? $category->meta_title : $category->name;
13   -$this->title = $category->name;
14   -$this->params[ 'breadcrumbs' ][] = $this->title;
15   -
16   -echo ListView::widget([
17   - 'dataProvider' => $dataProvider,
18   - 'options' => [
19   - 'class' => 'blocks_2',
20   - ],
21   - 'itemView' => '_category_item',
22   - 'layout' => '{items}',
23   -]);
  2 + use common\modules\product\models\Category;
  3 + use common\widgets\Seo;
  4 + use yii\data\ActiveDataProvider;
  5 + use yii\web\View;
  6 + use yii\widgets\ListView;
  7 +
  8 + /**
  9 + * @var Category $category
  10 + * @var ActiveDataProvider $dataProvider
  11 + * @var View $this
  12 + */
  13 + $this->params[ 'seo' ][ Seo::TITLE ] = !empty( $category->meta_title ) ? $category->meta_title : $category->name;
  14 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = !empty( $category->meta_desc ) ? $category->meta_desc : '';
  15 + $this->params[ 'seo' ][ Seo::SEO_TEXT ] = !empty( $category->seo_text ) ? $category->seo_text : '';
  16 + $this->params[ 'seo' ][ Seo::H1 ] = !empty( $category->h1 ) ? $category->h1 : $category->name;
  17 + $this->params[ 'breadcrumbs' ][] = $category->name;
  18 +
  19 + echo ListView::widget([
  20 + 'dataProvider' => $dataProvider,
  21 + 'options' => [
  22 + 'class' => 'blocks_2',
  23 + ],
  24 + 'itemView' => '_category_item',
  25 + 'layout' => '{items}',
  26 + ]);
24 27 ?>
25 28  
26 29 <div class="textile_bottom">
27 30 <div class="centered">
28   - <div class="title1 left"><?php echo $category->h1; ?></div>
29   - <div class="simple-spoiler just-closed" style="height: 50px">
30   - <div class="spoiler-inner"><?php echo $category->seo_text; ?></div>
31   - </div>
32   - <div class="just-more">
33   - <a href="#">Узнать больше</a>
34   - </div>
  31 + <h1 class="title1 left"><?php echo Seo::widget(['row' => Seo::H1]); ?></h1>
  32 + <div class="simple-spoiler just-closed" style="height: 50px">
  33 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]); ?></div>
  34 + </div>
  35 + <div class="just-more">
  36 + <a href="#">Узнать больше</a>
  37 + </div>
35 38 </div>
36 39 </div>
... ...
frontend/views/comments/index.php
... ... @@ -6,9 +6,10 @@
6 6 use common\models\Comments;
7 7 use common\modules\comment\widgets\CommentWidget;
8 8 use yii\web\View;
  9 + use common\widgets\Seo;
9 10  
10   - $this->title = 'Отзывы';
11   - $this->params['breadcrumbs'][] = $this->title;
  11 + $this->params[ 'seo' ][ Seo::TITLE ] = 'Отзывы';
  12 + $this->params['breadcrumbs'][] = 'Отзывы';
12 13 ?>
13 14  
14 15  
... ...
frontend/views/discount/discount.php
1 1 <?php
2   -/**
3   - * @var Product[] $products
4   - * @var View $this
5   - */
6   -use common\modules\product\models\Product;
7   -use yii\web\View;
8   -use common\components\artboximage\ArtboxImageHelper;
9   -use yii\helpers\Url;
  2 + /**
  3 + * @var Product[] $products
  4 + * @var View $this
  5 + */
  6 + use common\modules\product\models\Product;
  7 + use yii\web\View;
  8 + use common\components\artboximage\ArtboxImageHelper;
  9 + use yii\helpers\Url;
  10 + use common\widgets\Seo;
10 11  
11   -$this->title = 'Акции';
12   -$this->params['breadcrumbs'][] = $this->title;
  12 + $this->params[ 'breadcrumbs' ][] = 'Акции';
  13 + $this->params[ 'seo' ][ Seo::TITLE ] = 'Акции';
13 14  
14 15 ?>
15 16  
... ... @@ -17,32 +18,33 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
17 18 <div class="title8">Акции</div>
18 19 <div class="actions_cont">
19 20 <?php
20   - foreach ($products as $product) {
21   - ?>
22   - <div class="col-md-3 action">
23   - <a href="<?php echo Url::to([
24   - 'catalog/product',
25   - 'product' => $product->alias,
26   - 'variant' => $product->variant->sku,
27   - ])?>">
28   - <div class="picture"><?php echo ArtboxImageHelper::getImage($product->getImageUrl(), 'category_thumb'); ?></div>
29   - <div class="a_down">
30   - <div class="price"><?php echo $product->variant->price; ?> <span> €</span></div>
31   - <div class="titles">
32   - <div class="line1"><?php echo $product->name; ?></div>
33   - <div class="line2"><?php echo $product->category->name; ?></div>
34   - </div>
  21 + foreach($products as $product) {
  22 + ?>
  23 + <div class="col-md-3 action">
  24 + <a href="<?php echo Url::to([
  25 + 'catalog/product',
  26 + 'product' => $product->alias,
  27 + 'variant' => $product->variant->sku,
  28 + ]) ?>">
  29 + <div class="picture"><?php echo ArtboxImageHelper::getImage($product->getImageUrl(), 'category_thumb'); ?></div>
  30 + <div class="a_down">
  31 + <div class="price"><?php echo $product->variant->price; ?>
  32 + <span> €</span></div>
  33 + <div class="titles">
  34 + <div class="line1"><?php echo $product->name; ?></div>
  35 + <div class="line2"><?php echo $product->category->name; ?></div>
  36 + </div>
  37 + </div>
  38 + </a>
35 39 </div>
36   - </a>
37   - </div>
38   - <?php } ?>
  40 + <?php } ?>
39 41 <div style="clear:both;"></div>
40 42 </div>
41   -
  43 +
42 44 <div class="down act_d">
43   - <div class="d_title">Стильные элитные обои для вашего дома</div>
  45 + <h1 class="d_title"><?php echo Seo::widget(['row' => Seo::H1]);?></h1>
44 46 <div class="simple-spoiler just-closed" style="height: 50px">
45   - <div class="spoiler-inner">Продумывая дизайн своей квартиры, мы непременно тщательно выбираем "одежду" для стен - красивые модные обои.</div>
  47 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]);?></div>
46 48 </div>
47 49 <div class="just-more">
48 50 <a href="#">Узнать больше</a>
... ...
frontend/views/discount/empty.php
... ... @@ -7,4 +7,5 @@ use yii\web\View;
7 7 $this->title = 'Акции';
8 8 $this->params['breadcrumbs'][] = $this->title;
9 9  
10   -echo "Товары не найдены";
11 10 \ No newline at end of file
  11 +echo "Товары не найдены";
  12 +
12 13 \ No newline at end of file
... ...
frontend/views/new-collections/index.php
1 1 <?php
2   -use common\modules\product\models\Category;
3   -use yii\data\ActiveDataProvider;
4   -use yii\web\View;
5   -use yii\widgets\ListView;
6   -
7   -/**
8   - * @var Category $category
9   - * @var ActiveDataProvider $dataProvider
10   - * @var View $this
11   - */
12   -$this->title = 'Новые коллекции';
13   -$this->params[ 'breadcrumbs' ][] = $this->title;
  2 + use common\modules\product\models\Category;
  3 + use yii\data\ActiveDataProvider;
  4 + use yii\web\View;
  5 + use yii\widgets\ListView;
  6 + use common\widgets\Seo;
  7 +
  8 + /**
  9 + * @var Category $category
  10 + * @var ActiveDataProvider $dataProvider
  11 + * @var View $this
  12 + */
  13 + $this->params[ 'seo' ][ Seo::TITLE ] = 'Новые коллекции';
  14 + $this->params[ 'breadcrumbs' ][] = 'Новые коллекции';
14 15 ?>
15 16 <div class="blocks_2">
16   - <div class="col-md-12">
17   - <div class="title3">Новые коллекции <span>в Baccara Home</span></div>
18   - </div>
19   - <?php
20   - echo ListView::widget([
21   - 'dataProvider' => $dataProvider,
22   - 'itemOptions' => [
23   - 'tag' => false,
24   - ],
25   - 'itemView' => '_new_collections_item',
26   - 'layout' => '{items}',
27   - ]);
28   - ?>
29   - <?php if ($dataProvider->count > 6) { ?>
30   - <div class="col-md-12 filters f2">
31   - <a href="#" class="more_colls">Больше коллекций</a>
32   - </div>
33   - <?php } ?>
34   - </div>
35   - <div class="textile_bottom tb2">
36   - <div class="content">
37   - <div class="title1 left">Стильные элитные обои для вашего дома.</div>
38   - <div class="simple-spoiler just-closed" style="height: 50px">
39   - <div class="spoiler-inner">Продумывая дизайн своей квартиры, мы непременно тщательно выбираем «одежду» для стен — красивые модные обои.</div>
40   - </div>
41   - <div class="just-more">
42   - <a href="#">Узнать больше</a>
43   - </div>
44   - </div>
45   - </div>
46 17 \ No newline at end of file
  18 + <div class="col-md-12">
  19 + <div class="title3">Новые коллекции <span>в Baccara Home</span></div>
  20 + </div>
  21 + <?php
  22 + echo ListView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'itemOptions' => [
  25 + 'tag' => false,
  26 + ],
  27 + 'itemView' => '_new_collections_item',
  28 + 'layout' => '{items}',
  29 + ]);
  30 + ?>
  31 + <?php if($dataProvider->count > 6) { ?>
  32 + <div class="col-md-12 filters f2">
  33 + <a href="#" class="more_colls">Больше коллекций</a>
  34 + </div>
  35 + <?php } ?>
  36 +</div>
  37 +<div class="textile_bottom tb2">
  38 + <div class="content">
  39 + <div class="simple-spoiler just-closed" style="height: 50px">
  40 + <div class="spoiler-inner"><?php echo Seo::widget(['row' => Seo::SEO_TEXT]); ?></div>
  41 + </div>
  42 + <div class="just-more">
  43 + <a href="#">Узнать больше</a>
  44 + </div>
  45 + </div>
  46 +</div>
47 47 \ No newline at end of file
... ...
frontend/views/product/index.php
1 1 <?php
2   -
3   -/**
4   - * @var ActiveDataProvider $dataProvider
5   - * @var View $this
6   - * @var Category $category
7   - */
8   -use common\modules\product\models\Category;
9   -use yii\data\ActiveDataProvider;
10   -use yii\web\View;
11   -use yii\widgets\ListView;
12   -
13   -$this->title = $category->first_text;
14   -$this->params['breadcrumbs'][] = $this->title;
  2 +
  3 + /**
  4 + * @var ActiveDataProvider $dataProvider
  5 + * @var View $this
  6 + * @var Category $category
  7 + */
  8 + use common\modules\product\models\Category;
  9 + use yii\data\ActiveDataProvider;
  10 + use yii\web\View;
  11 + use yii\widgets\ListView;
  12 + use common\widgets\Seo;
  13 +
  14 + $this->params[ 'seo' ][ Seo::TITLE ] = !empty($category->meta_title) ? $category->meta_title : $category->first_text;
  15 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = !empty($category->meta_desc) ? $category->meta_desc : '';
  16 + $this->params[ 'breadcrumbs' ][] = $category->first_text;
15 17  
16 18 ?>
17 19  
... ... @@ -198,13 +200,13 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
198 200 </div>
199 201 <div class="col-md-9">
200 202 <div class="blocks_2">
201   -
  203 +
202 204 <?php echo ListView::widget([
203 205 'dataProvider' => $dataProvider,
204   - 'itemView' => '_product_list',
205   - 'layout' => '{items}{pager}',
206   - ])?>
207   -
  206 + 'itemView' => '_product_list',
  207 + 'layout' => '{items}{pager}',
  208 + ]) ?>
  209 +
208 210 </div>
209 211 </div>
210 212 </div>
... ...
frontend/views/site/page.php
1 1 <?php
2   -use common\models\Page;
3   -use yii\web\View;
4   -
5   -/**
6   - * @var Page $model
7   - * @var View $this
8   - *
9   - */
10   -
11   -$this->title = $model->title;
12   -$this->params['breadcrumbs'][] = $this->title;
13   -
14   -echo $model->body;
15 2 \ No newline at end of file
  3 + use common\models\Page;
  4 + use yii\web\View;
  5 + use common\widgets\Seo;
  6 +
  7 + /**
  8 + * @var Page $model
  9 + * @var View $this
  10 + */
  11 +
  12 + $this->params[ 'seo' ][ Seo::TITLE ] = !empty($model->meta_title) ? $model->meta_title : $model->title;
  13 + $this->params[ 'seo' ][ Seo::DESCRIPTION ] = !empty($model->meta_description) ? $model->meta_description : '';
  14 + $this->params[ 'breadcrumbs' ][] = $model->title;
  15 +
  16 + echo $model->body;
16 17 \ No newline at end of file
... ...
frontend/web/js/script.js
... ... @@ -18,7 +18,7 @@ $(document).ready(
18 18 if($(this).hasClass('opened')) {
19 19 $('.more a').text('Узнать больше');
20 20 } else {
21   - $('.more a').text('Скрыть');
  21 + $('.more a').text('Свернуть');
22 22 }
23 23 $(this).toggleClass('opened');
24 24 return false;
... ... @@ -112,7 +112,7 @@ $(document).ready(
112 112 event.preventDefault();
113 113 if($(".simple-spoiler").hasClass("just-closed"))
114 114 {
115   - $('.just-more a').text("Скрыть");
  115 + $('.just-more a').text("Свернуть");
116 116 $('.simple-spoiler').animate({height : spoilerFullHeight}, 1000);
117 117 } else
118 118 {
... ...