1

I have a CSV of products to import and each product has multiple categories, some with commas in the category name. To import a product and asign multiple categories, I would usually add a CSV column for _catagory and give a comma separated list of categories enclosed with double quotes:

sku,name,_category
1,Product 1,"Category 1,Category 2, Category 3"

However, if the category names have commas in them, how should I denote this in the CSV?

  • Category, 1
  • Category, 2
  • Category, 3

Perhaps escape the comma in the category name?

sku,name, _category
1,Product 1,"Category\, 1,Category\, 2, Category\, 3"

Or perhaps the only way to do this is to use the category ID rather than the name?

2

This is not how you import multiple categories. The correct way is to add a new line but without sku:

sku,name,_category
1,Product 1,Category1
,,Category2
,,Category3

As long as there is no new SKU, all lines belong to the same product.

  • I'm not really familiar with the old dataflow import, I thought you were refereeing to the new import/export because the dataflow is deprecated since version 1.5. See this answer. – Domeglic May 10 '15 at 6:36
  • Thanks @Domeglic for your reply. I applied your instruction but it produces error. – abu abu Jun 12 '17 at 5:07
0

In Magento 2+, there is the field called Multiple value separator and Fields enclosure. If your category name contains comma(,) then Multiple value separator should be having the value of " and Fields enclosure should be enabled for the following scenarios:

"Default Category/test11/test12, test13/test14 & test15"

Then Magento creates the structure as follows,

+Default Category
++test11
+++test12, test13
++++test14 & test15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.