Question

In Magento 1.x you could import different content for each store view by having each store data in new line and empty sku field. Unfortunately this seems not to work in Magento 2 and I could not find any information about it. The official docs are not very helpful on this matter.

I tried with following CSV:

sku,store_view_code,name
1111,,"Default name"
,et,"Translated name"

This results in error:

Please make sure attribute "sku" is not empty

I also tried to import translations separately, adding store_view_code with appropriate value:

sku,store_view_code,name
1111,et,"Translated name"

This actually did import content to correct store view, but it also deleted default name from database.

I do understand that I could just insert translations to catalog_product_entity_varchar and similar, with some custom script, but isn't there really no official/non-coding way of doing this in Magento 2?

Était-ce utile?

La solution

Apparently the solution is pretty simple. Too bad there is no word about it in official docs. My second approach in OP is almost correct, but you have to import all store views together in one import, including default. Separate import will reset field data for all store views and keep only the one's in last import. Difference with 1.x is that sku must be set for each store view. So the correct Magento 2 way should be something like this:

sku,store_view_code,name
1111,,"Default name"
1111,et,"Translated name"
1111,ru,"Another translation"

Note that this CSV will not work as initial import, but only as update of already existing product. You need to add required attributes for initial insert.

Autres conseils

It seams the selected answer from @ruuter is now not right any more. I use Magento 2.3.2 and I tried the Import for only 1 Store like:

sku,store_view_code,name
1111,et,"Translated name"

and selected "Add/Update" as "Import Behavior". It only updated the storeview data leaving the other stores and the default value as it is. Maybe the old behavior was a bug, that is now fixed.

Christian's approach does seem to be the reality now. However, I noticed that if I try to "Add/Update" a product which was added directly from Admin (I wanted to add translation of the name for other store views) then a separate product entry is created rather than have the name translated. I unchecked "Use Default Value" for the product name in Admin before the csv import. It looks like a translation for the product details, if the product was previously added via Admin, is possible only from Admin. Please do correct me if I'm wrong, I am relatively new in the Magento world.

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top