magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Exporting Products and Importing them to another store fails on multiple levels #11017

Closed ghost closed 6 years ago

ghost commented 6 years ago

Preconditions

  1. Magento 2.1.8 PHP 5.4.16 MySQL 5.6.37-82.2 Percona CentOS CentOS Linux release 7.4.1708 (Core)

Steps to reproduce

  1. Have a magento2 store working, clone it exactly.
  2. Enter new products in Magento Store A.
  3. Export products as csv from Magento Store A.
  4. Copy Images from Magento Store A pub/media/catalog/product to Magento Store B pub/media/import/product
  5. Use the csv you generated from Magento Store A on Magento Store B.

Expected result

  1. Products should Import.

Actual result

  1. The CSV does not pass validation. I had to delete several rows for a host of errors including: 1a) Please make sure attribute "name" is not empty. (a lot of this one) 1b) Value for 'finish' attribute contains incorrect value 1c) Value for 'price_type' attribute contains incorrect value 1d) Value for 'weight_type' attribute contains incorrect value 1e) Value for 'sku_type' attribute contains incorrect value 1f) Value for 'style' attribute contains incorrect value

  2. If you delete all rows from the csv that generated errors, you'll get more. Spend 3-4 hours simply removing (not even fixing) rows that have any problem.

  3. You get past the check data stage, and you get "Additional data: URL key for specified store already exists." This error seems to have been in core for over a year without a proper fix released yet and also affects saving categories. I tried to work around it but it consumed another 4-6 hours of research and attempting to fix it. Exasperated, I backuped up my database and deleted the url_rewrite table just to see if I could get import to work, surprise, there's another layer that doesn't work.

  4. It says the images I copied over with proper permissions and directory verified can't be read. So even if I deleted the images column I'd be without product images.

This is ridiculous, I spent about 2 working days on something that should take 30minutes, and work flawlessly, as the magento versions and environments are exactly identical, and product attributes were matching as well as all other data outside the products themselves. I'm very disappointed in this and feel this is yet another thing in Magento2 that is broken that is advertised to work, but will have to be fixed by expensive addon or my own even more expensive dev time, which makes unhappy clients and customers, and developers.

Tl;dr Exporting new products from a magento 2 store into another identical version and environment magento 2 store doesn't work for an absurd number of reasons.

orlangur commented 6 years ago

You get past the check data stage, and you get "Additional data: URL key for specified store already exists."

That's really strange, such error could only occur on Store B if you have it on Store A due to product not created via UI but with some migration/generation script.

Copy Images from Magento Store A pub/media/catalog/product to Magento Store B pub/media/import/product

It says the images I copied over with proper permissions and directory verified can't be read. So even if I deleted the images column I'd be without product images.

This is not a Magento issue, images should be copied with proper permissions - Magento do not change them.

Can you provide a reduced version of CSV which reveals such bugs? Not sure such scenario is checked frequently, probably some of them are observable with sample data.

ghost commented 6 years ago

I verified the permissions were right on the images, but it could be I'm missing something in that regard.

Unfortunately I can't provide you with example data as the data belongs my client who doesn't wish it shared.

I found my own fix, but it's a very situational fix as it depends on identical environments and Magento Store A being the one in which you want to keep the products and disregard any new changes to Magento Store B products. I did this by syncing only product tables, eav tables, and any addons that might also be affected.

Here is my script I put in an sh file.

mysqldump m2d_dev > m2d_dev_a.sql

mysqldump m2d_prod amasty_multiinventory_customer_group amasty_multiinventory_export amasty_multiinventory_store amasty_multiinventory_warehouse amasty_multiinventory_warehouse_import amasty_multiinventory_warehouse_item amasty_multiinventory_warehouse_order_item amasty_multiinventory_warehouse_quote_item amasty_multiinventory_warehouse_shipping aw_sbb_brand aw_sbb_brand_content aw_sbb_brand_website catalog_category_entity catalog_category_entity_datetime catalog_category_entity_decimal catalog_category_entity_int catalog_category_entity_text catalog_category_entity_varchar catalog_category_product catalog_category_product_cl catalog_category_product_index catalog_category_product_index_tmp catalog_compare_item catalog_eav_attribute catalog_product_attribute_cl catalog_product_bundle_option catalog_product_bundle_option_value catalog_product_bundle_price_index catalog_product_bundle_selection catalog_product_bundle_selection_price catalog_product_bundle_stock_index catalog_product_category_cl catalog_product_entity catalog_product_entity_datetime catalog_product_entity_decimal catalog_product_entity_gallery catalog_product_entity_int catalog_product_entity_media_gallery catalog_product_entity_media_gallery_value catalog_product_entity_media_gallery_value_to_entity catalog_product_entity_media_gallery_value_video catalog_product_entity_text catalog_product_entity_tier_price catalog_product_entity_varchar catalog_product_index_eav catalog_product_index_eav_decimal catalog_product_index_eav_decimal_idx catalog_product_index_eav_decimal_tmp catalog_product_index_eav_idx catalog_product_index_eav_tmp catalog_product_index_price catalog_product_index_price_bundle_idx catalog_product_index_price_bundle_opt_idx catalog_product_index_price_bundle_opt_tmp catalog_product_index_price_bundle_sel_idx catalog_product_index_price_bundle_sel_tmp catalog_product_index_price_bundle_tmp catalog_product_index_price_cfg_opt_agr_idx catalog_product_index_price_cfg_opt_agr_tmp catalog_product_index_price_cfg_opt_idx catalog_product_index_price_cfg_opt_tmp catalog_product_index_price_downlod_idx catalog_product_index_price_downlod_tmp catalog_product_index_price_final_idx catalog_product_index_price_final_tmp catalog_product_index_price_idx catalog_product_index_price_opt_agr_idx catalog_product_index_price_opt_agr_tmp catalog_product_index_price_opt_idx catalog_product_index_price_opt_tmp catalog_product_index_price_tmp catalog_product_index_tier_price catalog_product_index_website catalog_product_link catalog_product_link_attribute catalog_product_link_attribute_decimal catalog_product_link_attribute_int catalog_product_link_attribute_varchar catalog_product_link_type catalog_product_option catalog_product_option_price catalog_product_option_title catalog_product_option_type_price catalog_product_option_type_title catalog_product_option_type_value catalog_product_price_cl catalog_product_relation catalog_product_super_attribute catalog_product_super_attribute_label catalog_product_super_link catalog_product_website catalog_url_rewrite_product_category cataloginventory_stock cataloginventory_stock_cl cataloginventory_stock_item cataloginventory_stock_status cataloginventory_stock_status_idx cataloginventory_stock_status_tmp catalogrule catalogrule_customer_group catalogrule_group_website catalogrule_product catalogrule_product_cl catalogrule_product_price catalogrule_rule_cl catalogrule_website catalogsearch_fulltext_cl catalogsearch_fulltext_scope1 downloadable_link downloadable_link_price downloadable_link_purchased downloadable_link_purchased_item downloadable_link_title downloadable_sample downloadable_sample_title eav_attribute eav_attribute_group eav_attribute_label eav_attribute_option eav_attribute_option_swatch eav_attribute_option_value eav_attribute_set eav_entity eav_entity_attribute eav_entity_datetime eav_entity_decimal eav_entity_int eav_entity_store eav_entity_text eav_entity_type eav_entity_varchar eav_form_element eav_form_fieldset eav_form_fieldset_label eav_form_type eav_form_type_entity  > products_export_a.sql

mysql m2d_dev < products_export_a.sql

To get the images to work I just rsync'd the products directory across servers.

The domain name is the same I alter my hosts file to point to which identical server has the magento store, and the database server is the same, I just change the database name for the dev version.

It works very quickly and I don't have to worry about this, but I am still concerned very much about the product export/import issue as my client will need to use it to alter products in the future, and if the product export csv can't simply work when you try to reimport it, then that is a HUGE problem.

orlangur commented 6 years ago

@atrixtech thanks, of course I didn't mean production data sharing but some snippet after data anonymization.

Hope whoever will verify this issue will start from sample data and will be able to observe issues similar to yours. Otherwise it will be closed as nonreproducible.

magento-engcom-team commented 6 years ago

@atrixtech, thank you for your report. We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.