Commit 21c91e43cd8bcc5ab235e8b90322578a883fe5e1
1 parent
b71e91c1
big commti
Showing
1 changed file
with
22 additions
and
27 deletions
Show diff stats
frontend/widgets/Seo.php
... | ... | @@ -124,24 +124,10 @@ class Seo extends Widget |
124 | 124 | |
125 | 125 | |
126 | 126 | |
127 | - } else if (isset($filter["naznacenie"]) && count($filter["naznacenie"]) == 1) { | |
128 | - | |
129 | - $model = TaxOption::find()->where(['alias' => $filter["naznacenie"]])->one(); | |
130 | - if(!$model instanceof TaxOption){ | |
131 | - | |
132 | - \Yii::$app->response->redirect(['/site/error'],404); | |
133 | - } else { | |
134 | - if($this->selectSeoData(self::H1) == $this->category_name) { | |
135 | - | |
136 | - return $this->selectSeoData(self::H1) . ' ' . $model->value->value; | |
137 | - }else { | |
138 | - | |
139 | - return $this->selectSeoData(self::H1); | |
140 | - | |
141 | - } | |
142 | - | |
143 | - } | |
127 | + } else if ($this->checkFilter($filter)) { | |
144 | 128 | |
129 | + $array = $this->arrayBuilder($filter); | |
130 | + return $this->getNameString($array); | |
145 | 131 | |
146 | 132 | |
147 | 133 | } else { |
... | ... | @@ -391,20 +377,29 @@ class Seo extends Widget |
391 | 377 | $row = substr($row, 0,-1 ); |
392 | 378 | $row .= ". Лінія Світла"; |
393 | 379 | return $row; |
394 | -// $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one(); | |
395 | -// if($template instanceof SeoDynamic){ | |
396 | -// foreach ($array as $field_name => $field_value) { | |
397 | -// $template->title = str_replace('{' . $field_name . '}', mb_strtolower($field_value), $template->title); | |
398 | -// } | |
399 | -// $template = preg_replace('/\{.[^\}]*\}\s/','',$template->title); | |
400 | -// return $template; | |
401 | -// } | |
402 | -// | |
403 | -// return false; | |
404 | 380 | |
405 | 381 | } |
406 | 382 | |
407 | 383 | |
384 | + public function getNameString($array){ | |
385 | + // "Лучшие цены на {Название раздела | Название блока фильтра: Фильтр 1 | Название блока фильтра: Фильтр 2 | Название блока фильтра: Фильтр 3}. Лінія Світла"; | |
386 | + $row = ''; | |
387 | + foreach($array as $name => $field){ | |
388 | + | |
389 | + if($name == 'category' ){ | |
390 | + $row = $field.' | '.$row; | |
391 | + } else { | |
392 | + $row .= $field['name'] .' '.$field['value'].' | ' ; | |
393 | + } | |
394 | + | |
395 | + | |
396 | + | |
397 | + } | |
398 | + $row = substr($row, 0,-1 ); | |
399 | + return $row; | |
400 | + | |
401 | + } | |
402 | + | |
408 | 403 | public function arrayBuilder($filter) |
409 | 404 | { |
410 | 405 | ... | ... |