diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php index b590b41..64b42ec 100755 --- a/frontend/widgets/Seo.php +++ b/frontend/widgets/Seo.php @@ -101,21 +101,49 @@ class Seo extends Widget $filter = \Yii::$app->request->get('filters', []); - $default = $this->selectSeoData(self::H1); - if ($default != $this->{self::H1}) { - return $default; + if (isset($filter['brands']) && count($filter['brands']) == 1) { + $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one(); + if(!$model instanceof Brand){ - } else if(!empty($filter) && !$this->checkFilter($filter)){ + \Yii::$app->response->redirect(['/site/error'],404); + } else { + if($this->selectSeoData(self::H1) == $this->category_name) { - $array = $this->arrayBuilder($filter); - return $this->getNameString($array); - } - else { + return $this->selectSeoData(self::H1) . ' ' . $model->name ; + }else { + + return $this->selectSeoData(self::H1); + + } + } + + + + } else if (isset($filter["naznacenie"]) && count($filter["naznacenie"]) == 1) { + + $model = TaxOption::find()->where(['alias' => $filter["naznacenie"]])->one(); + if(!$model instanceof TaxOption){ - return $default; + \Yii::$app->response->redirect(['/site/error'],404); + } else { + if($this->selectSeoData(self::H1) == $this->category_name) { + + return $this->selectSeoData(self::H1) . ' ' . $model->value->value; + }else { + + return $this->selectSeoData(self::H1); + + } + + } + + + + } else { + return $this->selectSeoData(self::H1); } break; case self::TITLE: -- libgit2 0.21.4