From 21c91e43cd8bcc5ab235e8b90322578a883fe5e1 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 20 Oct 2016 14:56:05 +0300 Subject: [PATCH] big commti --- frontend/widgets/Seo.php | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/frontend/widgets/Seo.php b/frontend/widgets/Seo.php index 5701b73..1caa7fb 100755 --- a/frontend/widgets/Seo.php +++ b/frontend/widgets/Seo.php @@ -124,24 +124,10 @@ class Seo extends Widget - } else if (isset($filter["naznacenie"]) && count($filter["naznacenie"]) == 1) { - - $model = TaxOption::find()->where(['alias' => $filter["naznacenie"]])->one(); - if(!$model instanceof TaxOption){ - - \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 if ($this->checkFilter($filter)) { + $array = $this->arrayBuilder($filter); + return $this->getNameString($array); } else { @@ -391,20 +377,29 @@ class Seo extends Widget $row = substr($row, 0,-1 ); $row .= ". Лінія Світла"; return $row; -// $template = SeoDynamic::find()->select('title')->where(['param' =>'filters'])->one(); -// if($template instanceof SeoDynamic){ -// foreach ($array as $field_name => $field_value) { -// $template->title = str_replace('{' . $field_name . '}', mb_strtolower($field_value), $template->title); -// } -// $template = preg_replace('/\{.[^\}]*\}\s/','',$template->title); -// return $template; -// } -// -// return false; } + public function getNameString($array){ + // "Лучшие цены на {Название раздела | Название блока фильтра: Фильтр 1 | Название блока фильтра: Фильтр 2 | Название блока фильтра: Фильтр 3}. Лінія Світла"; + $row = ''; + foreach($array as $name => $field){ + + if($name == 'category' ){ + $row = $field.' | '.$row; + } else { + $row .= $field['name'] .' '.$field['value'].' | ' ; + } + + + + } + $row = substr($row, 0,-1 ); + return $row; + + } + public function arrayBuilder($filter) { -- libgit2 0.21.4