diff --git a/.htaccess b/.htaccess index 026c6cd..0ac042d 100755 --- a/.htaccess +++ b/.htaccess @@ -12,13 +12,13 @@ AddDefaultCharset utf-8 RewriteBase / # deal with admin first + #liniya svitla only + #redirect to remove the .html extension +# RewriteRule ^(.+)\.htm$ /product/old-item-$1 [L,NC,R=301] + Redirect 301 /Kak_vibrat_ryuksak / Redirect 301 /products/ryukzaki /catalog/ryukzaki - Redirect 301 /products/koshel_ki /catalog/koshelki - Redirect 301 /products/nesessery​ /catalog/nesessery - Redirect 301 /products/sumki /catalog/sumki - Redirect 301 /products/germochehly /catalog/germocehly RewriteRule ^storage/(.*)?$ /storage/$1 [L,PT] RewriteRule ^generator/(.*)?$ /generator/$1 [L,PT] @@ -89,6 +89,12 @@ AddDefaultCharset utf-8 RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] RewriteRule /$ /%1 [R,L] + + + RewriteCond %{THE_REQUEST} \s/+(.+?)/+[?\s] + RewriteRule /$ /%1 [R,L] + + RewriteCond %{HTTP_HOST} ^([^www].*)$ RewriteRule ^(.*)$ http://www.%1/$1 [R=301] diff --git a/common/modules/product/CatalogUrlManager.php b/common/modules/product/CatalogUrlManager.php index a94cecf..939c8e0 100755 --- a/common/modules/product/CatalogUrlManager.php +++ b/common/modules/product/CatalogUrlManager.php @@ -6,6 +6,7 @@ namespace common\modules\product; use common\modules\product\models\CategorySearch; use common\modules\product\models\ProductSearch; +use common\modules\product\models\ProductVariant; use Yii; use yii\helpers\Url; use yii\web\HttpException; @@ -22,8 +23,35 @@ class CatalogUrlManager implements UrlRuleInterface { */ public function parseRequest($manager, $request) { + + $pathInfo = $request->getPathInfo(); $paths = explode('/', $pathInfo); + /** + * linija-svitla.ua only + */ + $pattern = '/^(.+)\.htm$/'; + if(isset($paths[0])){ + preg_match($pattern,$paths[0], $match ); + if(!empty($match)){ + $old_item_name = explode('-',$paths[0] ); + if(isset($old_item_name[2]) && isset($old_item_name[3]) && isset($old_item_name[4])){ + $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4]; + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one(); + if($product_variant instanceof ProductVariant){ + + $link = 'product'.'/'. $product_variant->product->alias; + header("Status: 301"); + header("Location: http://www.test-22.artweb.com.ua/".$link); + die(); + } + } + } + } + + + + if(isset($paths[1])) { if(strripos($request->url,'catalog/'.$paths[1].'?') && (!strripos($request->url,'?page')) && (!strripos($request->url,'?sort'))){ @@ -61,6 +89,7 @@ class CatalogUrlManager implements UrlRuleInterface { } } } elseif ($paths[0] == 'product') { + if (!empty($paths[2])) { throw new HttpException(404 ,'Page not found'); } diff --git a/frontend/config/main.php b/frontend/config/main.php index 082a989..10cd43b 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -63,6 +63,8 @@ return [ 'route_map' => [ 'catalog' => 'catalog/category', 'product' => 'catalog/product', + '' => 'catalog/product', + ] ], diff --git a/frontend/views/event/_product_item.php b/frontend/views/event/_product_item.php new file mode 100755 index 0000000..c0a99b4 --- /dev/null +++ b/frontend/views/event/_product_item.php @@ -0,0 +1,111 @@ +category; +?> +
+
+
+ +
+ name, Url::to(['catalog/product', 'product' => $model->alias]), ['class'=>'btn-product-details'] )?> +
+ +
+ + variant->price_old){?> +
+ + variant->price_old ?>грн + +
+ +
+ Цена: + + variant->price ?> + грн + +
+
+
+
Особенности
+
+
+
    + +
  • Бренд: brand->name ?>
  • + + getActiveProperties($category->category_id) as $group): ?> +
  • name ?> _options as $option) : ?> ValueRenderHTML ?>
  • + + + +
+
+
+
+ +
+
+
+
+
+ \ No newline at end of file diff --git a/frontend/views/event/show.php b/frontend/views/event/show.php index b114172..d99c8a6 100755 --- a/frontend/views/event/show.php +++ b/frontend/views/event/show.php @@ -2,6 +2,8 @@ use frontend\assets\FlipclockAsset; use yii\helpers\Url; use yii\widgets\Breadcrumbs; +use yii\widgets\ListView; + FlipclockAsset::register($this); ?> title = $model->name;
- - models as $product) :?> - enabledVariants) ):?> - render('../catalog/_product_item', [ - 'model' => $product, - 'category' => $product->category, - ])?> - - + $productProvider, + 'itemView' => function ($model, $key, $index, $widget) { + return $this->render('_product_item',[ + 'model' => $model, + + ]); + }, + 'layout' => "{items}
{pager}", + ]) + + ?>
diff --git a/frontend/views/site/error.php b/frontend/views/site/error.php index d147e7c..ded3170 100755 --- a/frontend/views/site/error.php +++ b/frontend/views/site/error.php @@ -15,6 +15,9 @@ $this->title = 'Ошибка '.$code; width: 100%; height: 127px; text-align: center; + font-size: 165px; + color: #0f6fc7; + font-weight: bold; margin-top: 80px; } @@ -84,7 +87,7 @@ $this->title = 'Ошибка '.$code;
-
+
404!

Добро пожаловать на страницу 404!
Вы находитесь здесь, потому что ввели адрес страницы,
-- libgit2 0.21.4