Commit b161c194974fd222924fd38915c447e768e57f31
1 parent
3da72a43
14.09.16
Showing
1 changed file
with
13 additions
and
40 deletions
Show diff stats
frontend/widgets/Seo.php
... | ... | @@ -99,51 +99,24 @@ class Seo extends Widget |
99 | 99 | break; |
100 | 100 | case self::H1: |
101 | 101 | |
102 | - $filter = \Yii::$app->request->get('filters', []); | |
103 | - | |
104 | - | |
105 | - | |
106 | - if (isset($filter['brands']) && count($filter['brands']) == 1) { | |
107 | - | |
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 | 102 | |
103 | + $filter = \Yii::$app->request->get('filters', []); | |
124 | 104 | |
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 { | |
105 | + $default = $this->selectSeoData(self::H1); | |
136 | 106 | |
137 | - return $this->selectSeoData(self::H1); | |
107 | + if ($default != $this->{self::H1}) { | |
138 | 108 | |
139 | - } | |
109 | + return $default; | |
140 | 110 | |
141 | - } | |
142 | 111 | |
112 | + } else if(!empty($filter) && !$this->checkFilter($filter)){ | |
143 | 113 | |
114 | + $array = $this->arrayBuilder($filter); | |
115 | + return $this->getNameString($array); | |
116 | + } | |
117 | + else { | |
144 | 118 | |
145 | - } else { | |
146 | - return $this->selectSeoData(self::H1); | |
119 | + return $default; | |
147 | 120 | } |
148 | 121 | break; |
149 | 122 | case self::TITLE: |
... | ... | @@ -437,13 +410,13 @@ class Seo extends Widget |
437 | 410 | if($name == 'category' ){ |
438 | 411 | $row = $field.' '.$row; |
439 | 412 | } else { |
440 | - $row .= $field['name'] .' '.$field['value'].' ' ; | |
413 | + $row .= $field['value'].' ' ; | |
441 | 414 | } |
442 | 415 | |
443 | 416 | |
444 | 417 | |
445 | 418 | } |
446 | - $row = substr($row, 0,-2 ); | |
419 | + | |
447 | 420 | return $row; |
448 | 421 | |
449 | 422 | } |
... | ... | @@ -482,7 +455,7 @@ class Seo extends Widget |
482 | 455 | |
483 | 456 | \Yii::$app->response->redirect(['site/error'], 404); |
484 | 457 | } else { |
485 | - $array[$optionList]['value'] = $model->value; | |
458 | + $array[$optionList]['value'] = $model->value->value; | |
486 | 459 | $array[$optionList]['name'] = $name; |
487 | 460 | } |
488 | 461 | ... | ... |