Commit 3da72a43b643e06bfe9256697fe4edd519d73001
1 parent
5b77976b
14.09.16
Showing
1 changed file
with
37 additions
and
9 deletions
Show diff stats
frontend/widgets/Seo.php
| @@ -101,21 +101,49 @@ class Seo extends Widget | @@ -101,21 +101,49 @@ class Seo extends Widget | ||
| 101 | 101 | ||
| 102 | $filter = \Yii::$app->request->get('filters', []); | 102 | $filter = \Yii::$app->request->get('filters', []); |
| 103 | 103 | ||
| 104 | - $default = $this->selectSeoData(self::H1); | ||
| 105 | 104 | ||
| 106 | - if ($default != $this->{self::H1}) { | ||
| 107 | 105 | ||
| 108 | - return $default; | 106 | + if (isset($filter['brands']) && count($filter['brands']) == 1) { |
| 109 | 107 | ||
| 108 | + $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); | ||
| 109 | + if(!$model instanceof Brand){ | ||
| 110 | 110 | ||
| 111 | - } else if(!empty($filter) && !$this->checkFilter($filter)){ | 111 | + \Yii::$app->response->redirect(['/site/error'],404); |
| 112 | + } else { | ||
| 113 | + if($this->selectSeoData(self::H1) == $this->category_name) { | ||
| 112 | 114 | ||
| 113 | - $array = $this->arrayBuilder($filter); | ||
| 114 | - return $this->getNameString($array); | ||
| 115 | - } | ||
| 116 | - else { | 115 | + return $this->selectSeoData(self::H1) . ' ' . $model->name ; |
| 116 | + }else { | ||
| 117 | + | ||
| 118 | + return $this->selectSeoData(self::H1); | ||
| 119 | + | ||
| 120 | + } | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + } else if (isset($filter["naznacenie"]) && count($filter["naznacenie"]) == 1) { | ||
| 126 | + | ||
| 127 | + $model = TaxOption::find()->where(['alias' => $filter["naznacenie"]])->one(); | ||
| 128 | + if(!$model instanceof TaxOption){ | ||
| 117 | 129 | ||
| 118 | - return $default; | 130 | + \Yii::$app->response->redirect(['/site/error'],404); |
| 131 | + } else { | ||
| 132 | + if($this->selectSeoData(self::H1) == $this->category_name) { | ||
| 133 | + | ||
| 134 | + return $this->selectSeoData(self::H1) . ' ' . $model->value->value; | ||
| 135 | + }else { | ||
| 136 | + | ||
| 137 | + return $this->selectSeoData(self::H1); | ||
| 138 | + | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + } else { | ||
| 146 | + return $this->selectSeoData(self::H1); | ||
| 119 | } | 147 | } |
| 120 | break; | 148 | break; |
| 121 | case self::TITLE: | 149 | case self::TITLE: |