Magento 1 웹사이트를 Shopify 플랫폼으로 마이그레이션하는 방법은 다음과 같습니다.
Magento 1이 2020년 6월에 종료됨에 따라 모든 Magento 상점 소유자들은 기존 웹사이트를 Magento 2 또는 Shopify, WooCommerce와 같은 다른 인기 있는 전자상거래 플랫폼으로 마이그레이션하려고 하고 있습니다.
최근에 저는 제 클라이언트의 Magento 1 사이트 두 개를 Shopify로 이전했습니다. 처음에는 Magento에서 Shopify로 데이터를 이전하기 위해 인기 있는 데이터 마이그레이션 도구를 사용하려고 했지만, 저희에게는 잘 작동하지 않았습니다.
여기 성공적인 마이그레이션을 위해 제가 따랐던 단계입니다.
1 – 매그ento 데이터를 쇼피파이 형식으로 준비하기
Getbras.com은 여성 속옷을 판매하고 있으며, 제품은 Magento 사이트에 구성 가능한 제품으로 추가되었고, 사이즈와 색상에 따라 자식 변형이 있습니다. 따라서 Shopify 사이트에서도 동일한 구조를 따라야 합니다.
우리는 Magento에서 CSV로 데이터를 직접 내보낼 수 있지만, Shopify에 가져오기 위해 필요한 정확한 구조를 얻을 수는 없습니다. 그래서 Magento 1에서 데이터를 생성하고 이를 MYSQL 테이블에 저장하는 사용자 정의 PHP 스크립트를 작성하기로 결정했습니다. CSV로 직접 내보낼 수 있지만, 저장 테이블은 나중에 필요할 경우 일부 프로세스를 수행하는 데 도움이 될 수 있습니다.
Shopify에 구성 가능한 제품을 가져오기 위해 필요한 데이터는 다음과 같습니다:
- 핸들
- 제목
- 본문 HTML
- 공급업체
- 유형
- 태그
- 발행됨
- 옵션1 이름
- 옵션1 값
- 옵션2 이름
- 옵션2 값
- 변형 SKU
- 변형 그램
- 변형_재고_추적기
- 변형_재고_수량
- 변형_재고_정책
- 변형_이행_서비스
- 변형_가격
- 변형_비교_정가
- 변형_배송_필요
- 변형_과세
- 변형_바코드
- Image_Src
- 이미지_위치
- 이미지_대체_텍스트
- SEO_제목
- SEO_설명
- 변형_무게_단위
- 변형_세금_코드
나는 위 데이터를 저장하기 위해 mysql 테이블을 만들었고, 사용자 정의 magento 1 스크립트를 사용하여 데이터를 생성했습니다. 다음은 사용한 php 코드입니다.
<?php
ini_set('memory_limit','2048M');
ini_set('max_execution_time',12000);
require_once "app/Mage.php";
$root=$_SERVER['DOCUMENT_ROOT'];
Mage::app("default");
Mage::app()->loadAreaPart(Mage_Core_Model_App_Area::AREA_FRONTEND,Mage_Core_Model_App_Area::PART_EVENTS);
//Mage::init();
$connection = Mage::getSingleton('core/resource')->getConnection('dbname');
$_helper = Mage::helper('catalog/output');
$helper = Mage::helper('shoppersettings/image');
$imgX = 252;
$imgY = $helper->calculateHeight($imgX);
//$filename = 'google_pla_feed_magento.csv';
$link=mysql_connect("localhost",'','');
mysql_select_db('dbname',$link);
https://bras-honey.myshopify.com/search?type=product&q=Loungeable%2Bboutique
$_productCollection = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect(array('pre_order','name', 'price','special_price','brand','color','size','lingerie_type', 'image', 'status','short_description','description','sku','created_at'))
->addAttributeToFilter('type_id', array('eq' => 'configurable'))
->addAttributeToFilter('entity_id', array('gt' => $last_id))
->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED));
//->setPageSize(10);
//->setCurPage($p)
$i=0;
$k=0;
foreach ($_productCollection as $_product):
$name= $_product->getName();
$name=str_replace("&","&",$name);
$sku=$_product->getSku();
$created_at=$_product->getCreatedAt();
$text=explode(" ",$sku);
$sku=$text[0];
$url_key = $_product->getProductUrl();
$full_url_key = $_product->getProductUrl();
//preparing unique handle for shopify
$url_key = str_replace("https://www.example.com/", "", $url_key);
$url_key = str_replace(".html", "", $url_key);
$id=$_product->getId();
$pre_order_status=$_product->getPreOrder();
if($pre_order_status==""):
$pre_order_status=0;
endif;
$product = Mage::getModel('catalog/product')->load($id);
$desc=strip_tags($product->getDescription());
$desc=str_replace(" "," ",$desc);
$desc=str_replace("&","&",$desc);
$desc1=$product->getDescription();
$short_desc1=$product->getShortDescription();
$productMediaConfig = Mage::getModel('catalog/product_media_config');
$image_url = $productMediaConfig->getMediaUrl($product->getImage());
$final_price=$product->getFinalPrice();
$meta_title=$product->getMetaTitle();
$meta_desc=$product->getMetaDescription();
$special_price=$product->getSpecialPrice();
$type_id=$product->getLingerieType();
$brand_id=$product->getBrand();
$final_price=number_format($final_price, 2, '.', '');
$desc1=str_replace(" "," ",$desc1);
$desc1=str_replace("&","&",$desc1);
$desc1=str_replace('\\',"",$desc1);
$desc1=str_replace("'","\'",$desc1);
$short_desc1=str_replace(" "," ",$short_desc1);
$short_desc1=str_replace("&","&",$short_desc1);
$short_desc1=str_replace('\\',"",$short_desc1);
$short_desc1=str_replace("'","\'",$short_desc1);
$desc1 = $short_desc1.$desc1;
preg_match_all('~<a(.*?)href="([^"]+)"(.*?)>~', $desc1, $matches);
foreach ($matches[2] as $key => $value) {
$value = str_replace("https://www.example.com/", "", $value);
$value = str_replace("http://www.example.com/", "", $value);
// echo '-----';
//replacing magento url in the content with shopify url
$sql1="SELECT id_path FROM mg_core_url_rewrite WHERE request_path='$value'";
$res1=mysql_query($sql1,$link) or die(mysql_error());
if(mysql_num_rows($res1)>0){
while($rs1=mysql_fetch_object($res1)){
$id_path = $rs1->id_path;
if(strpos($id_path,'product/') !== false){
$value1 = 'products/'.$value;
$desc1 = str_replace($value,$value1,$desc1);
}elseif(strpos($id_path,'category/') !== false){
$text = explode("/",$value);
$l = count($text);
$value1 = 'collections/'.$text[$l-1];
$desc1 = str_replace($value,$value1,$desc1);
}
}
}
if(strpos($value,'catalogsearch/') !== false){
$text = explode("?q=",$value);
$value1 = 'search?type=product&q='.$text[1];
$desc1 = str_replace($value,$value1,$desc1);
}
}
$desc1 = str_replace(".html","",$desc1);
$pId="";
$status=0;
$lingerie_type="";
$brand = Mage::getModel('catalog/product')->load($id)->getAttributeText('brand');
$brand1=$brand;
$brand=str_replace("&","&",$brand);
$lingerie_type = Mage::getModel('catalog/product')->load($id)->getAttributeText('lingerie_type');
$lingerie_type1=$lingerie_type;
$lingerie_type=str_replace("&","&",$lingerie_type);
if($lingerie_type==""):
$lingerie_type="Lingerie";
endif;
$product = Mage::getModel('catalog/product')->load($id);
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$product);
$cats = $_product->getCategoryIds();
$j=0;
$category_name="";
foreach ($cats as $category_id){
$_cat = Mage::getModel('catalog/category')->load($category_id) ;
if($j<10):
$category_name.=trim($_cat->getName()).',';
endif;
$j++;
}
$category_name=substr($category_name,0,strlen($category_name)-1);
//getting child variants of magento configurable products
foreach($childProducts as $child) {
$k++;
$child_sku =$child->getSku();
$child_id=$child->getId();
$child_name=$child->getName();
$weight=$child->getWeight();
$qty=$child->getQty();
$size_id=$child->getSize();
$color_id=$child->getColor();
$type_id =$child->getLingerieType();
$size = Mage::getModel('catalog/product')->load($child_id)->getAttributeText('size');
$color = Mage::getModel('catalog/product')->load($child_id)->getAttributeText('color');
$lingerie_type = Mage::getModel('catalog/product')->load($child_id)->getAttributeText('lingerie_type');
$text=explode("-",$child_sku);
$text1=explode(" ",$text[2]);
$child_sku=$text[0].'-'.$text[1].'-'.$text1[0];
$name = mysql_real_escape_string($name);
$meta_title = mysql_real_escape_string($meta_title);
$meta_desc = mysql_real_escape_string($meta_desc);
//adding product temp mysql table
$sql="INSERT INTO magento_shopify(Handle,Title,Body_HTML,Vendor,Type,Tags,Option1_Value,Option2_Value,Variant_SKU,Variant_Grams,Variant_Inventory_Qty,Variant_Price,Variant_Compare_At_Price,Variant_Barcode,Image_Src,Image_Position,Image_Alt_Text,SEO_Title,SEO_Description,Variant_Tax_Code) VALUES ('$url_key','$name','$desc1','$brand','$lingerie_type','$category_name','$color','$size','$child_sku','$weight','$qty','$final_price','$special_price','','$image_url','','$name','$meta_title','$meta_desc','')";
mysql_query($sql,$link) or die(mysql_error());
}
$i++;
endforeach;
exit;
?>
After run above script you can see all of your necessary magento data in mysql table. You can check and verify using phpmyadmin
An example screenshot here:

이제 phpmyadmin에서 데이터를 내보낼 수 있습니다.

데이터를 CSV 형식으로 내보내고 열 이름을 헤더로 추가하세요.

데이터를 내보낸 후, CSV 파일을 Excel에서 열고 Shopify 가져오기 CSV 템플릿과 일치하는 열 헤더를 업데이트해야 합니다. 아래에 사용한 예제 CSV가 있습니다.
