Commit 446efeebb169b4de747fc034e126579945cdfcef

Authored by Dmytry Fedorchuk
1 parent f57afab3

SEO

backend/views/category/_form.php
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 2
3 use yii\helpers\Html; 3 use yii\helpers\Html;
4 use yii\widgets\ActiveForm; 4 use yii\widgets\ActiveForm;
  5 +use mihaildev\ckeditor\CKEditor;
  6 +use mihaildev\elfinder\ElFinder;
5 use common\modules\file\widgets\ImageUploader; 7 use common\modules\file\widgets\ImageUploader;
6 use kartik\select2\Select2; 8 use kartik\select2\Select2;
7 9
@@ -63,7 +65,17 @@ use kartik\select2\Select2; @@ -63,7 +65,17 @@ use kartik\select2\Select2;
63 65
64 <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?> 66 <?= $form->field($model, 'meta_robots')->textInput(['maxlength' => true]) ?>
65 67
66 - <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> 68 + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?>
  69 +
  70 + <?= $form->field($model, 'seo_text')->widget(CKEditor::className(),
  71 + [
  72 + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[
  73 + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать
  74 + 'inline' => false, //по умолчанию false]),
  75 + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload')
  76 + ]
  77 + )
  78 + ]) ?>
67 79
68 <?php if (!empty($model) && $model->depth == 2) :?> 80 <?php if (!empty($model) && $model->depth == 2) :?>
69 <?= $form->field($model, 'populary')->checkbox() ?> 81 <?= $form->field($model, 'populary')->checkbox() ?>
backend/views/category/view.php
@@ -40,10 +40,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title; @@ -40,10 +40,12 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
40 'meta_title', 40 'meta_title',
41 'meta_desc:ntext', 41 'meta_desc:ntext',
42 'meta_robots', 42 'meta_robots',
  43 + 'h1',
43 'seo_text:ntext', 44 'seo_text:ntext',
44 'category_name_id', 45 'category_name_id',
45 'product_unit_id', 46 'product_unit_id',
46 'alias', 47 'alias',
  48 +
47 ], 49 ],
48 ]) ?> 50 ]) ?>
49 51
common/config/main.php
@@ -10,12 +10,6 @@ return [ @@ -10,12 +10,6 @@ return [
10 'jsOptions' => ['position' => \yii\web\View::POS_HEAD] 10 'jsOptions' => ['position' => \yii\web\View::POS_HEAD]
11 ] 11 ]
12 ], 12 ],
13 -  
14 - ],  
15 - 'smssender' => [  
16 -  
17 - 'class' => 'common\components\SmsSender',  
18 -  
19 ], 13 ],
20 14
21 'cache' => [ 15 'cache' => [
common/modules/product/models/Category.php
@@ -86,7 +86,7 @@ class Category extends \yii\db\ActiveRecord @@ -86,7 +86,7 @@ class Category extends \yii\db\ActiveRecord
86 return [ 86 return [
87 [['name'], 'string'], 87 [['name'], 'string'],
88 [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'], 88 [['parent_id', 'depth', 'category_name_id', 'product_unit_id'], 'integer'],
89 - [['path', 'meta_desc', 'seo_text'], 'string'], 89 + [['path', 'meta_desc', 'h1', 'seo_text'], 'string'],
90 [['meta_title', 'image'], 'string', 'max' => 255], 90 [['meta_title', 'image'], 'string', 'max' => 255],
91 [['meta_robots'], 'string', 'max' => 50], 91 [['meta_robots'], 'string', 'max' => 50],
92 [['alias', 'name'], 'string', 'max' => 250], 92 [['alias', 'name'], 'string', 'max' => 250],
@@ -113,6 +113,7 @@ class Category extends \yii\db\ActiveRecord @@ -113,6 +113,7 @@ class Category extends \yii\db\ActiveRecord
113 'meta_title' => Yii::t('product', 'Meta Title'), 113 'meta_title' => Yii::t('product', 'Meta Title'),
114 'meta_desc' => Yii::t('product', 'Meta Desc'), 114 'meta_desc' => Yii::t('product', 'Meta Desc'),
115 'meta_robots' => Yii::t('product', 'Meta Robots'), 115 'meta_robots' => Yii::t('product', 'Meta Robots'),
  116 + 'h1' => Yii::t('product', 'h1'),
116 'seo_text' => Yii::t('product', 'Seo Text'), 117 'seo_text' => Yii::t('product', 'Seo Text'),
117 'product_unit_id' => Yii::t('product', 'Product Unit ID'), 118 'product_unit_id' => Yii::t('product', 'Product Unit ID'),
118 'alias' => Yii::t('product', 'Alias'), 119 'alias' => Yii::t('product', 'Alias'),
common/modules/product/widgets/views/products_block.php
@@ -4,7 +4,14 @@ use yii\web\View; @@ -4,7 +4,14 @@ use yii\web\View;
4 <?php if(!empty($products)) :?> 4 <?php if(!empty($products)) :?>
5 <div class="_prd_spec-wr"> 5 <div class="_prd_spec-wr">
6 <div class="special-products products<?= (!empty($class) ? ' '. $class : '')?>"> 6 <div class="special-products products<?= (!empty($class) ? ' '. $class : '')?>">
7 - <h3><?= $title?></h3> 7 + <span style="text-align: center;
  8 + text-transform: uppercase;
  9 + font-size: 20px; display: block;
  10 + -webkit-margin-before: 1em;
  11 + -webkit-margin-after: 1em;
  12 + -webkit-margin-start: 0px;
  13 + -webkit-margin-end: 0px;
  14 + font-weight: bold;"><?= $title?></span>
8 <div class="owl-carousel"> 15 <div class="owl-carousel">
9 <?php foreach($products as $product) :?> 16 <?php foreach($products as $product) :?>
10 <?= $this->render('product_smart', ['product' => $product]);?> 17 <?= $this->render('product_smart', ['product' => $product]);?>
frontend/views/basket/_popup.php
@@ -6,7 +6,13 @@ use yii\helpers\Url; @@ -6,7 +6,13 @@ use yii\helpers\Url;
6 <div class="item_added_win"> 6 <div class="item_added_win">
7 <a href="#" class="black_close"></a> 7 <a href="#" class="black_close"></a>
8 <div class="block_content"> 8 <div class="block_content">
9 - <h2>Товар добавлен в корзину</h2> 9 + <span style="display: block;
  10 + font-size: 1.5em;
  11 + -webkit-margin-before: 0.83em;
  12 + -webkit-margin-after: 0.83em;
  13 + -webkit-margin-start: 0px;
  14 + -webkit-margin-end: 0px;
  15 + font-weight: bold;">Товар добавлен в корзину</span>
10 <div class="items"> 16 <div class="items">
11 <div class="basket_items"> 17 <div class="basket_items">
12 18
frontend/views/catalog/products.php
@@ -7,15 +7,20 @@ use yii\helpers\Url; @@ -7,15 +7,20 @@ use yii\helpers\Url;
7 use yii\widgets\Breadcrumbs; 7 use yii\widgets\Breadcrumbs;
8 use yii\web\View; 8 use yii\web\View;
9 use common\modules\product\helpers\ProductHelper; 9 use common\modules\product\helpers\ProductHelper;
  10 +use frontend\widgets\Seo;
  11 +//$this->title = $category->categoryName->value;
  12 +$this->params['seo']['title'] = !empty($category->meta_title) ? $category->meta_title : $category->name;
  13 +$this->params['seo']['h1'] = !empty($category->h1) ? $category->h1 : $category->name;
  14 +$this->params['seo']['seo_text'] = $category->seo_text;
  15 +$this->params['seo']['description'] = $category->meta_desc;
  16 +$this->params['seo']['meta'] = $category->meta_robots;
10 17
11 -$this->title = $category->categoryName->value;  
12 //foreach($category->getParents()->all() as $parent) { 18 //foreach($category->getParents()->all() as $parent) {
13 // $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]]; 19 // $this->params['breadcrumbs'][] = ['label' => $parent->categoryName->value, 'url' => ['catalog/category', 'category' => $parent]];
14 //} 20 //}
15 $this->params['breadcrumbs'][] = ['label' => 'Каталог', 'url' => ['catalog/category']]; 21 $this->params['breadcrumbs'][] = ['label' => 'Каталог', 'url' => ['catalog/category']];
16 $this->params['breadcrumbs'][] = $category->categoryName->value; 22 $this->params['breadcrumbs'][] = $category->categoryName->value;
17 23
18 -$this->params['seo']['title'] = $category->name;  
19 24
20 $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.css')); 25 $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.css'));
21 $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.skinHTML5.css')); 26 $this->registerCssFile (Yii::getAlias('@web/css/ion.rangeSlider.skinHTML5.css'));
@@ -155,7 +160,7 @@ $this-&gt;registerJsFile(Yii::getAlias(&#39;@web/js/ion.rangeSlider.js&#39;),[ @@ -155,7 +160,7 @@ $this-&gt;registerJsFile(Yii::getAlias(&#39;@web/js/ion.rangeSlider.js&#39;),[
155 </div> 160 </div>
156 161
157 <div class="content"> 162 <div class="content">
158 - <h1><?= $category->name ?></h1> 163 + <h1><?= Seo::widget([ 'row'=>'h1'])?></h1>
159 <div class="sort_menu"> 164 <div class="sort_menu">
160 165
161 <div class="sort_block"> 166 <div class="sort_block">
@@ -188,8 +193,12 @@ $this-&gt;registerJsFile(Yii::getAlias(&#39;@web/js/ion.rangeSlider.js&#39;),[ @@ -188,8 +193,12 @@ $this-&gt;registerJsFile(Yii::getAlias(&#39;@web/js/ion.rangeSlider.js&#39;),[
188 <?php endif?> 193 <?php endif?>
189 <div class="both"></div> 194 <div class="both"></div>
190 </div> 195 </div>
  196 + <div class="text">
  197 + <?= Seo::widget([ 'row'=>'seo_text'])?>
  198 + </div>
191 <div class="both"></div> 199 <div class="both"></div>
192 200
  201 +
193 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?> 202 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'promo'])?>
194 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?> 203 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'new'])?>
195 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'top'])?> 204 <?= \common\modules\product\widgets\specialProducts::widget(['type' => 'top'])?>
frontend/widgets/Seo.php
@@ -42,7 +42,7 @@ class Seo extends Widget @@ -42,7 +42,7 @@ class Seo extends Widget
42 foreach ($seoData as $key => $value) { 42 foreach ($seoData as $key => $value) {
43 $this->$key = $value; 43 $this->$key = $value;
44 } 44 }
45 - 45 +
46 46
47 switch ($this->row) { 47 switch ($this->row) {
48 case self::SEO_TEXT: 48 case self::SEO_TEXT:
@@ -108,7 +108,7 @@ class Seo extends Widget @@ -108,7 +108,7 @@ class Seo extends Widget
108 'content' => $meta 108 'content' => $meta
109 ]); 109 ]);
110 110
111 - } else if ( 111 + } else if (
112 isset($filter['brands']) && count($filter['brands']) > 1 112 isset($filter['brands']) && count($filter['brands']) > 1
113 || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1 113 || isset($filter['options']["pol"]) && count($filter['options']["pol"]) > 1
114 || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1 114 || isset($filter['options']["naznacenie"]) && count($filter['options']["naznacenie"]) > 1