Commit ea07e7cb369f25e294b85f3c432f1fb6faa6ce0e
1 parent
0deff972
canonical update2.0
Showing
3 changed files
with
9 additions
and
3 deletions
Show diff stats
common/modules/product/CatalogUrlManager.php
@@ -102,6 +102,8 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -102,6 +102,8 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
102 | public function createUrl($manager, $route, $params) | 102 | public function createUrl($manager, $route, $params) |
103 | { | 103 | { |
104 | 104 | ||
105 | + | ||
106 | + | ||
105 | if (!in_array($route, $this->route_map)) { | 107 | if (!in_array($route, $this->route_map)) { |
106 | return false; | 108 | return false; |
107 | } | 109 | } |
@@ -131,10 +133,13 @@ class CatalogUrlManager implements UrlRuleInterface { | @@ -131,10 +133,13 @@ class CatalogUrlManager implements UrlRuleInterface { | ||
131 | break; | 133 | break; |
132 | 134 | ||
133 | case 'catalog/product': | 135 | case 'catalog/product': |
136 | + | ||
134 | if (!empty($params['product'])) { | 137 | if (!empty($params['product'])) { |
135 | $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']); | 138 | $product_alias = is_object($params['product']) ? $params['product']->alias : strtolower($params['product']); |
139 | + $url = 'product/'. $product_alias; | ||
140 | + } else { | ||
141 | + $url = 'product/'; | ||
136 | } | 142 | } |
137 | - $url = 'product/'. $product_alias; | ||
138 | 143 | ||
139 | if (!empty($params) && ($query = http_build_query($params)) !== '') { | 144 | if (!empty($params) && ($query = http_build_query($params)) !== '') { |
140 | $url .= '?' . $query; | 145 | $url .= '?' . $query; |
frontend/config/main.php
@@ -108,6 +108,7 @@ return [ | @@ -108,6 +108,7 @@ return [ | ||
108 | ], | 108 | ], |
109 | ],*/ | 109 | ],*/ |
110 | 'urlManager' => [ | 110 | 'urlManager' => [ |
111 | + 'baseUrl' => 'http://rukzachok.com.ua', | ||
111 | 'enablePrettyUrl' => true, | 112 | 'enablePrettyUrl' => true, |
112 | 'showScriptName' => false, | 113 | 'showScriptName' => false, |
113 | 'rules' => [ | 114 | 'rules' => [ |
frontend/views/layouts/main.php
@@ -78,8 +78,8 @@ $this->registerJs(" | @@ -78,8 +78,8 @@ $this->registerJs(" | ||
78 | <title><?= Seo::widget([ 'row'=>'title'])?></title> | 78 | <title><?= Seo::widget([ 'row'=>'title'])?></title> |
79 | <?= Seo::widget([ 'row'=>'description'])?> | 79 | <?= Seo::widget([ 'row'=>'description'])?> |
80 | <?= Seo::widget([ 'row'=>'meta'])?> | 80 | <?= Seo::widget([ 'row'=>'meta'])?> |
81 | - <?= $this->registerLinkTag(['rel' => 'canonical', 'href' => Url::canonical()]); ?> | ||
82 | - <link rel="shortcut icon" href="<?= Yii::$app->request->baseUrl ?>/img/favicon.ico" type="image/x-icon"/> | 81 | + <?php $this->registerLinkTag(['rel' => 'canonical', 'href' => Yii::$app->urlManager->baseUrl.Yii::$app->request->url ]); ?> |
82 | + <link rel="shortcut icon" href="<?= Yii::$app->urlManager->baseUrl ?>/img/favicon.ico" type="image/x-icon"/> | ||
83 | <?php $this->head () ?> | 83 | <?php $this->head () ?> |
84 | 84 | ||
85 | <!-- SOCIAL ICON --> | 85 | <!-- SOCIAL ICON --> |