{"id":255,"date":"2016-04-23T10:17:59","date_gmt":"2016-04-23T10:17:59","guid":{"rendered":"http:\/\/blog.chen-hongyi.com\/?p=255"},"modified":"2016-04-23T10:17:59","modified_gmt":"2016-04-23T10:17:59","slug":"magento2-%e4%b8%8b%e5%af%bc%e5%85%a5%e4%ba%a7%e5%93%81csv%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/chen-hongyi.com\/?p=255","title":{"rendered":"Magento2 \u4e0b\u5bfc\u5165\u4ea7\u54c1CSV\u6587\u4ef6"},"content":{"rendered":"<p>\u6bcf\u6b21\u5bfc\u5165\u90fd\u8bf4\u6709\u9519\uff0c\u8fd9\u91cc\u6709\u4e2a\u5b57\u6bb5\u8bf4\u660e\u3002\u539f\u6587\u5730\u5740<\/p>\n<p><a href=\"https:\/\/firebearstudio.com\/blog\/the-complete-guide-to-magento-2-product-import-export.html\">https:\/\/firebearstudio.com\/blog\/the-complete-guide-to-magento-2-product-import-export.html<\/a><\/p>\n<p>\u5b57\u6bb5\u8bf4\u660e<\/p>\n<p>The CSV File Structure<\/p>\n<p>Let\u2019s have a look at CSV file structure for Magento 2 product import. Below, you can find a detailed description of its columns.<\/p>\n<p><strong>sku <\/strong>\u2013 a unique product identifier used as a key product attribute in the Magento 2 core. It is required for all products and should be unique for each of them. sku can include both digits and letters without spaces separated with underscores (_) and dashes (-). \u552f\u4e00\u7684\u6807\u793a\u3002\u5b57\u6bcd\u548c\u6570\u5b57\u3002\u4e0d\u5e26\u7a7a\u683c\u3002\u5141\u8bb8\u4e0b\u5212\u7ebf\u548c\u6a2a\u7ebf\u3002<\/p>\n<p><strong>store_view_code<\/strong> \u2013 an associated store view code. The column can be empty if an associated store \/ website have a single sub item.<\/p>\n<p><strong>attribute_set_code<\/strong> \u2013 a product attribute set code. Create and configure an attribute set before importing products into Magento 2. It should look exactly the same as an attribute set name including capital letters (e.g. \u201cDefault\u201d, \u201cMan shoes\u201d etc.)<br \/>\n<strong>product_type<\/strong> \u2013 the type of an imported product. Use only lowercase letters (small, configurable etc.) \u5fc5\u987b\u5c0f\u5199<br \/>\n<strong>categories<\/strong> &#8211; product categories in Magento 2 differs from ones utilized in Magento 1, where comma separated category ids are used. In Magento 2, full names of assigned categories, including full path, are required. Besides, assigned categories should be separated by |. For instance, \u201cDefault Category\/Gear|Default Category\/Gear\/Bags\u201d means that product should be assigned to both Gear and Bags categories. The latest one is a subcategory of Gear. \u00a0\u548cv1\u7684\u9017\u53f7\u5206\u5272id\u4e0d\u540c\u3002v2\u91cc\u662f\u5206\u7c7b\u7684\u5b8c\u6574\u8def\u5f84\u540d\u79f0\uff0c\u7528|\u5206\u5272\u3002<br \/>\n<strong>product_websites<\/strong> \u2013 an associated product website code. Use lowercase letters only (e.g. \u201cbase\u201d). \u53ea\u80fd\u5c0f\u5199<br \/>\n<strong>name<\/strong> &#8211; a product name.<br \/>\n<strong>description<\/strong> &#8211; a product description. \u53ef\u4ee5\u5305\u542bHTML<br \/>\n<strong>short_description<\/strong> &#8211; a short description of a product. Both, description and short description, could include valid HTML tags.\u53ef\u4ee5\u5305\u542bHTML<br \/>\n<strong>weight<\/strong> &#8211; a weight of a product. Requires using the following format 1.00000.<br \/>\n<strong>product_online<\/strong> &#8211; enables or disables products. Use 1 or 0 respectively. \u662f\u5426\u5728\u7ebf\u4ea7\u54c1\u3002\u75281\u6807\u793a\u662f\uff0c0\u8868\u793a\u5426<br \/>\n<strong>tax_class_name<\/strong> &#8211; a product tax class. Allows using capital later and spaces, like in Magento 2 backend (e.g. \u201cTaxable Goods\u201d). \u7a0e\u52a1\u7b49\u7ea7<br \/>\n<strong>visibility<\/strong> &#8211; a visibility of a product (e.g. \u201cCatalog, Search\u201d, \u201cNot Visible Individually\u201d etc.). \u53ef\u89c1<\/p>\n<p><strong>price<\/strong> &#8211; a price of a product (e.g. 34.000). \u4ef7\u683c<br \/>\n<strong>special_price<\/strong> &#8211; a special price of a product (e.g. 34.000). \u7279\u4ef7<br \/>\n<strong>special_price_from_date<\/strong> &#8211; time when Magento starts using a special price instead of a default one (e.g. \u20192015-09-01 15:26:29\u2019). \u7279\u4ef7\u5f00\u59cb\u65e5\u671f<br \/>\n<strong>special_price_to_date<\/strong> \u2013 time when MAgento stops using a special price (e.g. \u20192015-09-01 15:26:29\u2019). \u7279\u4ef7\u622a\u6b62\u65e5\u671f<br \/>\n<strong>url_key<\/strong> &#8211; an URL key of product. In case of an empty field, a value is generated automatically based on a product name.<br \/>\n<strong>meta_title<\/strong> \u2013 a meta title of a product. \u4ea7\u54c1\u9875meta\u6807\u7b7e\u6807\u9898<br \/>\n<strong>meta_keywords<\/strong> &#8211; product meta keywords meta\u5173\u952e\u5b57<br \/>\n<strong>meta_description<\/strong> &#8211; a product meta description meta\u63cf\u8ff0<br \/>\n<strong>base_image<\/strong> &#8211; the main product\u2019s image and its path. Should be uploaded to \/pub\/media\/import. The path of \/sample_data\/m\/b\/mb01-blue-0.jpg has the following structure: \/pub\/media\/import\/sample_data\/m\/b\/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http:\/\/site.com\/images\/some_image.jpg.<br \/>\nbase_image_label &#8211; a label of a base product image. \u4e3b\u8981\u56fe\u7247\u8def\u5f84\u3002\u76f8\u5bf9\u8def\u5f84\u6216URL\u8def\u5f84\u3002<br \/>\n<strong>small_image<\/strong> &#8211; a name and a path related to a small product image. Should be also uploaded to \/pub\/media\/import. The path of \/sample_data\/m\/b\/mb01-blue-0.jpg has the following structure: \/pub\/media\/import\/sample_data\/m\/b\/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http:\/\/site.com\/images\/some_image.jpg.<br \/>\nsmall_image_label &#8211; a label of a small product image. \u5c0f\u56fe\u5730\u5740<br \/>\n<strong>thumbnail_image<\/strong> \u2013 a name and a path related to a thumbnail product image. Should be uploaded to \/pub\/media\/import as well. The path of \/sample_data\/m\/b\/mb01-blue-0.jpg has the following structure: \/pub\/media\/import\/sample_data\/m\/b\/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http:\/\/site.com\/images\/some_image.jpg. \u7f29\u56fe\u5730\u5740<br \/>\n<strong>thumbnail_image_label<\/strong> &#8211; a product thumbnail label \u7f29\u56fe\u6807\u7b7e<br \/>\n<strong>created_at<\/strong> &#8211; time when a product was created. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). If the field is empty, date and time of data base record are used. \u521b\u5efa\u65e5\u671f\u3002\u6ce8\u610f\u683c\u5f0f\u3002<br \/>\n<strong>updated_at<\/strong> &#8211; time when a product was updated in. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). If the field is empty, date and time of data base record are used. \u66f4\u65b0\u65e5\u671f<br \/>\n<strong>new_from_date<\/strong> &#8211; sets a product as \u201cnew\u201d from the specified date. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). \u5f00\u59cb\u8bbe\u4e3anew\u7684\u65e5\u671f<br \/>\n<strong>new_to_date<\/strong> &#8211; stops displaying a product as \u201cnew\u201d from the specified date. Use the following format: yyyy-mm-dd hh-mm-ss (e.g. 2015-09-01 22:26:27). \u5b9a\u5236\u8bbe\u4e3anew\u7684\u65e5\u671f<br \/>\n<strong>display_product_options_in<\/strong> &#8211; it is a new feature introduced in Magento 2 which specifies a place on a product page where a block with options should be displayed (e.g. \u201cBlock after Info Column\u201d). V2\u7684\u65b0\u6280\u80fd<br \/>\n<strong>map_price<\/strong> \u2013 a minimum price of a product.<br \/>\n<strong>msrp_price<\/strong> &#8211; a product\u2019s MSRP price.<br \/>\n<strong>map_enabled<\/strong> &#8211; use it to enable \/ disable a product\u2019s minimum price.<br \/>\n<strong>gift_message_available<\/strong> &#8211; shows that a gift message is available and will be displayed for a particular product.<br \/>\n<strong>custom_design<\/strong> \u2013 a custom design of a product page.<br \/>\n<strong>custom_design_from<\/strong> &#8211; a starting date for a custom design of a product page.<br \/>\n<strong>custom_design_to<\/strong> &#8211; an end date for a custom design of a product page.<br \/>\n<strong>custom_layout_update<\/strong> \u2013 a custom XML layout for a product page<br \/>\n<strong>page_layout<\/strong> &#8211; a product page layout (e.g. 1 Column). If empty the field is empty, a default product layout is used.<br \/>\n<strong>product_options_container<\/strong> \u2013 a product options container.<br \/>\n<strong>msrp_display_actual_price_type<\/strong> &#8211; a type of a product\u2019s MSRP price.<br \/>\n<strong>country_of_manufacture<\/strong> &#8211; a country of origin.<br \/>\n<strong>additional_attributes<\/strong> &#8211; import of product custom options and data related to a simple product associated to a configurable product. A sample value for a simple product associated to configurable product: \u201ccolor=Red,has_options=0,required_options=0,size_pants=32\u201d (Color attribute is \u201cRed,\u201d simple product has options in Magento 2: has_options = 0 \u2013 no required options, size pants attribute value is 32). A sample value for a configurable product in Magento 2 \u2013 \u201chas_options=1,required_options=1\u201d (Product has required options, simple product SKU is associated in the _associated_sku column ). \u9644\u52a0\u5c5e\u6027<br \/>\n<strong>qty<\/strong> &#8211; a quantity of a particular product in stock. \u5e93\u5b58\u6570<br \/>\n<strong>out_of_stock_qty<\/strong> &#8211; an out of stock quantity of a particular product.<br \/>\n<strong>use_config_min_qty<\/strong> &#8211; use minimum quantity value from config.<br \/>\n<strong>is_qty_decimal<\/strong> &#8211; set 1 if a quantity can be decimal.<br \/>\n<strong>allow_backorders<\/strong> &#8211; set 1 if backorders are enabled.<br \/>\nuse_config_backorders &#8211; use a default system value for backorder options (enable \/ disable).<br \/>\nmin_cart_qty &#8211; a minimum required quantity of a product in shopping cart.<br \/>\nuse_config_min_sale_qty &#8211; use a default config value for determining a minimum quantity of a sale product.<br \/>\nmax_cart_qty \u2013 a maximum quantity of a product in a shopping cart.<br \/>\nuse_config_max_sale_qty \u2013 use a default config value to determine a maximum quantity of a product in a shopping cart.<br \/>\nis_in_stock \u2013 1 \u2013 a product is in stock, 0 \u2013 a product is out of stock.<br \/>\nnotify_on_stock_below \u2013 set a minimum product quantity to start a notification about a low stock level.<br \/>\nuse_config_notify_stock_qty \u2013 use a default system value for a product\u2019s low stock notification.<br \/>\nmanage_stock &#8211; to control a stock quantity of a product set 1. By setting 0 you allow Magento 2 to consider a product has an unlimited stock level.<br \/>\nuse_config_manage_stock &#8211; use a default system configuration value for stock management.<br \/>\nuse_config_qty_increments &#8211; use a product quantity increment from current store configuration. Set 1 to enable; set 0 to disable.<br \/>\nqty_increments &#8211; a product quantity increment.<br \/>\nuse_config_enable_qty_inc &#8211; use a default store configuration value to enable a product quantity increment.<br \/>\nenable_qty_increments &#8211; set 1 or 0 to enable or disable product quantity increment.<br \/>\nis_decimal_divided &#8211; set 1 if a product quantity increment can be decimal.<br \/>\nwebsite_id &#8211; an associated product website ID<br \/>\n<strong>related_skus<\/strong> &#8211; related products SKUs separated with commas (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)<br \/>\n<strong>crosssell_skus<\/strong> &#8211; cross-sale product SKUs separated with commas (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)<br \/>\n<strong>upsell_skus<\/strong> &#8211; upsallers product SKUs separated with comma (e.g. 24-WG085_Group,24-WG086,24-WG083-blue,24-UG01)<br \/>\n<strong>additional_images<\/strong> &#8211; additional product images (product media gallery) separated with commas. Images should be uploaded to \/pub\/media\/import. The path of \/sample_data\/m\/b\/mb01-blue-0.jpg has the following structure: \/pub\/media\/import\/sample_data\/m\/b\/mb01-blue-0.jpg. In addition, you can use a direct URL of an image, such as http:\/\/site.com\/images\/some_image.jpg. \u9644\u4ef6\u56fe\u7247<br \/>\n<strong>additional_image_labels<\/strong> &#8211; \u0421omma separated labels for additional product images from the previous column. \u9644\u52a0\u56fe\u7247\u6807\u7b7e<br \/>\n_associated_sku &#8211; an associated simple product SKU for a configurable product (several values should be separated with commas).<br \/>\n_associated_default_qty &#8211; a default quantity for associated products<br \/>\n_associated_position &#8211; associated products position, based on the _associated_sku column<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6bcf\u6b21\u5bfc\u5165\u90fd\u8bf4\u6709\u9519\uff0c\u8fd9\u91cc\u6709\u4e2a\u5b57\u6bb5\u8bf4\u660e\u3002\u539f\u6587\u5730\u5740 https:\/\/firebears &hellip; <a href=\"https:\/\/chen-hongyi.com\/?p=255\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-255","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/255","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=255"}],"version-history":[{"count":1,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions"}],"predecessor-version":[{"id":256,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=\/wp\/v2\/posts\/255\/revisions\/256"}],"wp:attachment":[{"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=255"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=255"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chen-hongyi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=255"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}