Commit 5b77976b870aa6d4e72c6f13d0971d58acfca8e0

Authored by Administrator
1 parent 62cd1755

14.09.16

Showing 1 changed file with 9 additions and 37 deletions   Show diff stats
frontend/widgets/Seo.php
... ... @@ -101,49 +101,21 @@ class Seo extends Widget
101 101  
102 102 $filter = \Yii::$app->request->get('filters', []);
103 103  
  104 + $default = $this->selectSeoData(self::H1);
104 105  
  106 + if ($default != $this->{self::H1}) {
105 107  
106   - if (isset($filter['brands']) && count($filter['brands']) == 1) {
  108 + return $default;
107 109  
108   - $model = Brand::find()->where(['alias' => $filter['brands'][0]])->one();
109   - if(!$model instanceof Brand){
110   -
111   - \Yii::$app->response->redirect(['/site/error'],404);
112   - } else {
113   - if($this->selectSeoData(self::H1) == $this->category_name) {
114   -
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){
129   -
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 110  
  111 + } else if(!empty($filter) && !$this->checkFilter($filter)){
143 112  
  113 + $array = $this->arrayBuilder($filter);
  114 + return $this->getNameString($array);
  115 + }
  116 + else {
144 117  
145   - } else {
146   - return $this->selectSeoData(self::H1);
  118 + return $default;
147 119 }
148 120 break;
149 121 case self::TITLE:
... ...