Commit bdc6c84cac921d80fc1e219f851e52f21eb82a9f

Authored by Administrator
1 parent 54b15bc5

14.09.16

frontend/views/catalog/products.php
@@ -183,7 +183,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[ @@ -183,7 +183,7 @@ $this->registerJsFile(Yii::getAlias('@web/js/ion.rangeSlider.js'),[
183 </div> 183 </div>
184 184
185 <div class="content" itemscope itemtype="http://schema.org/Product"> 185 <div class="content" itemscope itemtype="http://schema.org/Product">
186 - <div itemprop="name"><h1><?= Seo::widget([ 'row'=>'h1'])?></h1></div> 186 + <div itemprop="name"><h1><?= ucfirst ( strtolower (Seo::widget([ 'row'=>'h1'])))?></h1></div>
187 <div itemprop="offers" itemscope itemtype="http://schema.org/AggregateOffer" style="display: none;"> 187 <div itemprop="offers" itemscope itemtype="http://schema.org/AggregateOffer" style="display: none;">
188 <span itemprop="priceCurrency">UAH</span> 188 <span itemprop="priceCurrency">UAH</span>
189 <span itemprop="lowPrice"><?= $priceLimits['min'] ?></span> 189 <span itemprop="lowPrice"><?= $priceLimits['min'] ?></span>
frontend/widgets/Seo.php
@@ -27,6 +27,7 @@ class Seo extends Widget @@ -27,6 +27,7 @@ class Seo extends Widget
27 public $key; 27 public $key;
28 public $name; 28 public $name;
29 public $project_name; 29 public $project_name;
  30 + public static $optionsList;
30 protected static $check_url; 31 protected static $check_url;
31 protected static $check_url_bool; 32 protected static $check_url_bool;
32 33
@@ -41,6 +42,10 @@ class Seo extends Widget @@ -41,6 +42,10 @@ class Seo extends Widget
41 { 42 {
42 $this->url = \Yii::$app->request->url; 43 $this->url = \Yii::$app->request->url;
43 $this->project_name = \Yii::$app->name; 44 $this->project_name = \Yii::$app->name;
  45 + if(empty(self::$optionsList)){
  46 + self::$optionsList = ArrayHelper::getColumn(TaxGroup::find()->where(['is_filter' => 'TRUE'])->all(),'alias');
  47 + }
  48 +
44 parent::init(); 49 parent::init();
45 50
46 } 51 }
@@ -50,6 +55,8 @@ class Seo extends Widget @@ -50,6 +55,8 @@ class Seo extends Widget
50 { 55 {
51 56
52 $seoData = $this->getViewData(); 57 $seoData = $this->getViewData();
  58 +
  59 +
53 foreach ($seoData as $key => $value) { 60 foreach ($seoData as $key => $value) {
54 $this->$key = $value; 61 $this->$key = $value;
55 } 62 }
@@ -109,7 +116,7 @@ class Seo extends Widget @@ -109,7 +116,7 @@ class Seo extends Widget
109 } else { 116 } else {
110 if($this->selectSeoData(self::H1) == $this->category_name) { 117 if($this->selectSeoData(self::H1) == $this->category_name) {
111 118
112 - return ucfirst ( strtolower ($this->selectSeoData(self::H1) . ' ' . $model->name )); 119 + return $this->selectSeoData(self::H1) . ' ' . $model->name ;
113 }else { 120 }else {
114 121
115 return $this->selectSeoData(self::H1); 122 return $this->selectSeoData(self::H1);
@@ -128,7 +135,7 @@ class Seo extends Widget @@ -128,7 +135,7 @@ class Seo extends Widget
128 } else { 135 } else {
129 if($this->selectSeoData(self::H1) == $this->category_name) { 136 if($this->selectSeoData(self::H1) == $this->category_name) {
130 137
131 - return ucfirst ( strtolower ($this->selectSeoData(self::H1) . ' ' . $model->value->value)); 138 + return $this->selectSeoData(self::H1) . ' ' . $model->value->value;
132 }else { 139 }else {
133 140
134 return $this->selectSeoData(self::H1); 141 return $this->selectSeoData(self::H1);
@@ -170,10 +177,8 @@ class Seo extends Widget @@ -170,10 +177,8 @@ class Seo extends Widget
170 } 177 }
171 178
172 179
173 - $optionsList = ArrayHelper::getColumn(TaxGroup::find()->where(['is_filter' => 'TRUE'])->all(),'alias');  
174 -  
175 180
176 - foreach($optionsList as $optionList){ 181 + foreach(self::$optionsList as $optionList){
177 182
178 183
179 if (isset($filter[$optionList]) && count($filter[$optionList]) == 1) { 184 if (isset($filter[$optionList]) && count($filter[$optionList]) == 1) {
@@ -259,10 +264,7 @@ class Seo extends Widget @@ -259,10 +264,7 @@ class Seo extends Widget
259 ]); 264 ]);
260 265
261 } else if ( 266 } else if (
262 - isset($filter['brands']) && count($filter['brands']) > 1  
263 - || isset($filter["pol"]) && count($filter["pol"]) > 1  
264 - || isset($filter["naznacenie"]) && count($filter["naznacenie"]) > 1  
265 - || isset($filter["god"]) && count($filter["god"]) > 1 267 + isset($filter['brands']) && count($filter['brands']) > 1 || isset($filter) && $this->checkFilter($filter)
266 268
267 ) { 269 ) {
268 $this->getView()->registerMetaTag([ 270 $this->getView()->registerMetaTag([
@@ -272,7 +274,7 @@ class Seo extends Widget @@ -272,7 +274,7 @@ class Seo extends Widget
272 274
273 } else if ( 275 } else if (
274 isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter) && count($filter, COUNT_RECURSIVE) >= 4 276 isset($filter['brands']) && count($filter['brands']) <= 1 && isset($filter) && count($filter, COUNT_RECURSIVE) >= 4
275 - || isset($filter) && count($filter, COUNT_RECURSIVE) > 4 277 + || isset($filter) && count($filter, COUNT_RECURSIVE) >1
276 || !empty($sort) || !empty($paginate) || isset($filter['prices']) 278 || !empty($sort) || !empty($paginate) || isset($filter['prices'])
277 ) { 279 ) {
278 $this->getView()->registerMetaTag([ 280 $this->getView()->registerMetaTag([
@@ -296,6 +298,18 @@ class Seo extends Widget @@ -296,6 +298,18 @@ class Seo extends Widget
296 298
297 } 299 }
298 300
  301 +
  302 +
  303 + protected function checkFilter($filter){
  304 + $status = false;
  305 + foreach(self::$optionsList as $optionList){
  306 +
  307 + $status = isset($filter[$optionList]) && count($filter[$optionList]) > 1;
  308 +
  309 + }
  310 + return $status;
  311 + }
  312 +
299 protected function replaceData($str) 313 protected function replaceData($str)
300 { 314 {
301 315
@@ -373,7 +387,7 @@ class Seo extends Widget @@ -373,7 +387,7 @@ class Seo extends Widget
373 387
374 } 388 }
375 389
376 - return ucfirst ( strtolower ( $this->replaceData($result) ) ); 390 + return $this->replaceData($result);
377 391
378 } 392 }
379 393