Commit 3d33f4f5f1f04dbca80e807a059b3f63bab017b3

Authored by Administrator
1 parent 9612cf03

big commti

Showing 1 changed file with 39 additions and 0 deletions   Show diff stats
common/modules/product/CatalogUrlManager.php
... ... @@ -35,9 +35,48 @@ class CatalogUrlManager implements UrlRuleInterface {
35 35 preg_match($pattern,$paths[0], $match );
36 36 if(!empty($match)){
37 37 $old_item_name = explode('-',$paths[0] );
  38 +
  39 + if(isset($old_item_name[5]) && isset($old_item_name[5]) == 'dis' ){
  40 + $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4];
  41 + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one();
  42 + if($product_variant instanceof ProductVariant){
  43 +
  44 + $link = 'product'.'/'. $product_variant->product->alias;
  45 + header("Status: 301");
  46 + header("Location: http://www.test-22.artweb.com.ua/".$link);
  47 + die();
  48 + }
  49 + }
  50 +
  51 +
  52 + if(isset($old_item_name[2]) && isset($old_item_name[3]) && isset($old_item_name[4])&& isset($old_item_name[5])){
  53 + $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4].'/'.isset($old_item_name[5]);
  54 + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one();
  55 + if($product_variant instanceof ProductVariant){
  56 +
  57 + $link = 'product'.'/'. $product_variant->product->alias;
  58 + header("Status: 301");
  59 + header("Location: http://www.test-22.artweb.com.ua/".$link);
  60 + die();
  61 + }
  62 + }
  63 +
38 64 if(isset($old_item_name[2]) && isset($old_item_name[3]) && isset($old_item_name[4])){
39 65 $sku = $old_item_name[2].'/'.$old_item_name[3].'/'.$old_item_name[4];
40 66 $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one();
  67 +
  68 + if($product_variant instanceof ProductVariant){
  69 +
  70 + $link = 'product'.'/'. $product_variant->product->alias;
  71 + header("Status: 301");
  72 + header("Location: http://www.test-22.artweb.com.ua/".$link);
  73 + die();
  74 + }
  75 + }
  76 +
  77 + if(isset($old_item_name[2]) && isset($old_item_name[3])){
  78 + $sku = $old_item_name[2].'/'.$old_item_name[3];
  79 + $product_variant = ProductVariant::find()->where(['sku'=>$sku])->one();
41 80 if($product_variant instanceof ProductVariant){
42 81  
43 82 $link = 'product'.'/'. $product_variant->product->alias;
... ...