diff --git a/common/modules/product/CatalogUrlManager.php b/common/modules/product/CatalogUrlManager.php index 68145c8..c5aa9e6 100755 --- a/common/modules/product/CatalogUrlManager.php +++ b/common/modules/product/CatalogUrlManager.php @@ -15,8 +15,6 @@ use yii\web\UrlRuleInterface; class CatalogUrlManager implements UrlRuleInterface { public $route_map = []; - - public $option_prefix = 'o:'; /** * Parses the given request and returns the corresponding route and parameters. * @param \yii\web\UrlManager $manager the URL manager @@ -60,24 +58,6 @@ class CatalogUrlManager implements UrlRuleInterface { $this->parseFilter($paths[2], $params); } - else if(strpos($paths[2], 'filter:') === 0){ - $this->parseOldFilter($paths[2], $params); - //['catalog/category', 'category' => $category, 'filters' =>$params['filter']] - - $optionsTemplate = FilterHelper::optionsTemplate(); - array_unshift($optionsTemplate, "special", "brands"); - $filterView = []; - foreach($optionsTemplate as $optionKey){ - if(isset($params['filter'][$optionKey])){ - $filterView[$optionKey] = $params['filter'][$optionKey]; - } - - - } - - - Yii::$app->response->redirect(['catalog/category', 'category' => $category, 'filters' =>$filterView],301); - } else { throw new HttpException(404 ,'Page not found'); } @@ -117,6 +97,7 @@ class CatalogUrlManager implements UrlRuleInterface { if (!empty($params['category'])) { $category_alias = is_object($params['category']) ? $params['category']->alias : strtolower($params['category']); $url = 'catalog/'. $category_alias .'/'; + unset($params['category']); } else { $url = 'catalog/'; } @@ -139,6 +120,7 @@ class CatalogUrlManager implements UrlRuleInterface { case 'catalog/product': if (!empty($params['product'])) { $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']); + unset($params['product']); } $url = 'product/'. $product_alias; @@ -151,23 +133,6 @@ class CatalogUrlManager implements UrlRuleInterface { return $url; break; -// case 'catalog/brands': -// if (empty($params['brand'])) { -// return 'brands'; -// } else { -// -// $brand_alias = is_object($params['brand']) ? $params['brand']->alias : strtolower($params['brand']); -// } -// $url = 'brands/'. $brand_alias .'/'; -// -// $this->setFilterUrl($params, $url); -// -// if (!empty($params) && ($query = http_build_query($params)) !== '') { -// $url .= '?' . $query; -// } -// -// return $url; -// break; } } @@ -224,30 +189,4 @@ class CatalogUrlManager implements UrlRuleInterface { } } - - - private function parseOldFilter($paths, &$params) { - $params['filter'] = []; - $filter_str = substr($paths, 7); - $filter_options = explode(';', $filter_str); - foreach ($filter_options as $filter_option) { - if (empty($filter_option)) { - continue; - } - list($filter_key, $filter_option) = explode('=', $filter_option); - if($filter_key == 'prices') { // price-interval section - $prices = explode(':', $filter_option); - $params['filter'][$filter_key] = [ - 'min' => floatval($prices[0]), - 'max' => floatval($prices[1]), - ]; - } - elseif (strpos($filter_key, $this->option_prefix) === 0) { // options section - $params['filter'][substr($filter_key, 2)] = explode(',', $filter_option); - } - else { // brands and other sections - $params['filter'][$filter_key] = explode(',', $filter_option); - } - } - } } \ No newline at end of file -- libgit2 0.21.4