Commit 9612cf03ccfeabf0ff73ff248664da8b889af59f
1 parent
cbff1199
big commti
Showing
1 changed file
with
17 additions
and
3 deletions
Show diff stats
frontend/widgets/Seo.php
... | ... | @@ -27,6 +27,7 @@ class Seo extends Widget |
27 | 27 | public $key; |
28 | 28 | public $name; |
29 | 29 | public $project_name; |
30 | + public static $optionsList; | |
30 | 31 | protected static $check_url; |
31 | 32 | protected static $check_url_bool; |
32 | 33 | |
... | ... | @@ -41,6 +42,10 @@ class Seo extends Widget |
41 | 42 | { |
42 | 43 | $this->url = \Yii::$app->request->url; |
43 | 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 | 49 | parent::init(); |
45 | 50 | |
46 | 51 | } |
... | ... | @@ -222,9 +227,7 @@ class Seo extends Widget |
222 | 227 | |
223 | 228 | } else if ( |
224 | 229 | isset($filter['brands']) && count($filter['brands']) > 1 |
225 | - || isset($filter["pol"]) && count($filter["pol"]) > 1 | |
226 | - || isset($filter["naznacenie"]) && count($filter["naznacenie"]) > 1 | |
227 | - || isset($filter["god"]) && count($filter["god"]) > 1 | |
230 | + || isset($filter) && $this->checkFilter($filter) | |
228 | 231 | |
229 | 232 | ) { |
230 | 233 | $this->getView()->registerMetaTag([ |
... | ... | @@ -450,5 +453,16 @@ class Seo extends Widget |
450 | 453 | |
451 | 454 | } |
452 | 455 | |
456 | + protected function checkFilter($filter){ | |
457 | + foreach(self::$optionsList as $optionList){ | |
458 | + | |
459 | + if(isset($filter[$optionList]) && count($filter[$optionList]) > 1){ | |
460 | + return true; | |
461 | + } | |
462 | + | |
463 | + } | |
464 | + return false; | |
465 | + } | |
466 | + | |
453 | 467 | |
454 | 468 | } |
455 | 469 | \ No newline at end of file | ... | ... |