From 3d33f4f5f1f04dbca80e807a059b3f63bab017b3 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 20 Oct 2016 12:17:58 +0300 Subject: [PATCH] big commti --- common/modules/product/CatalogUrlManager.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+), 0 deletions(-) diff --git a/common/modules/product/CatalogUrlManager.php b/common/modules/product/CatalogUrlManager.php index 939c8e0..9f854d0 100755 --- a/common/modules/product/CatalogUrlManager.php +++ b/common/modules/product/CatalogUrlManager.php @@ -35,9 +35,48 @@ class CatalogUrlManager implements UrlRuleInterface { preg_match($pattern,$paths[0], $match ); if(!empty($match)){ $old_item_name = explode('-',$paths[0] ); + + if(isset($old_item_name[5]) && isset($old_item_name[5]) == 'dis' ){ + $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($old_item_name[2]) && isset($old_item_name[3]) && isset($old_item_name[4])&& isset($old_item_name[5])){ + $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4].'/'.isset($old_item_name[5]); + $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($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($old_item_name[2]) && isset($old_item_name[3])){ + $sku = $old_item_name[2].'/'.$old_item_name[3]; + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one(); if($product_variant instanceof ProductVariant){ $link = 'product'.'/'. $product_variant->product->alias; -- libgit2 0.21.4