magento-engcom / import-export-improvements

Open Software License 3.0
31 stars 29 forks source link

[MAGETWO-43470] ImportExport Option with coma rise PHP Notice #65

Open piotrekkaminski opened 6 years ago

piotrekkaminski commented 6 years ago

Error when import product with option label which contains symbols "," (coma) maybe doesn't work with others separator symbols (|,=)

Preconditions

None

Steps to reproduce

  1. Create product with option name "green,white"
  2. Export products
  3. Import back this CSV

Expected result

  1. Import succeeds. Option with name "green,white" present.

Actual result

  1. Error message import_option
tadhgbowe commented 6 years ago

Hello. Is this when importing product customizable options? Have we got an example CSV file? Thanks, Tadhg

dmanners commented 6 years ago

@tadhgbowe this is for attribute options for example if you setup colour on a product.

tadhgbowe commented 6 years ago

Hello. An update from me on this one:

[TESTED on 2.3-develop branch].

Lets zoom in on product attribute "color". I created a new Option "White, Cream" in the Admin Panel and it saved fine. I then tried to import a new virtual product with a "color" column and the value "White, Cream". It imported fine. I then tried to import just a color change using the "additional_attributes" column with the values "color=White, Cream,size=36". Both values imported fine.

When I then tried to import a new configurable product linking to the above virtual product using the configurable_variations with a value like this "sku=SKU123,size=34,color=White, Cream" it throws the following errors:

  1. Invalid option value for attribute "color" in row(s): 1
  2. Attribute with code "cream" is not super in row(s): 1

So, if "additional_attributes" column works then we need to find a way of making the "configurable_variations" work too.

I will continue my testing.

Cheers Tadhg

tadhgbowe commented 6 years ago

@dmanners - Quick Update:

I have a solution written to allow the comma character be part of a valid super attribute option value inside the configurable_variations column. For example "color=White, Cream"

I will test with other characters like "=", "-" and "|" next. If all is well then I shall submit a pull request.

Thanks, Tadhg

tadhgbowe commented 6 years ago

@dmanners - Test results with "|" pipe character.

I created a color with an option value of "Yellow | Orange"

This causes a product import failure when you try to assign that value to a configurable_variations SKU e.g. sku=YellowOrange34,size=34,color=Yellow | Orange

The pipe character is the default multi-line separator for the configurable_variations column. So there's more work required here. In the above example you can see a space before and after the "|". This also presents a problem because when they get split temporarily the value is trimmed.

Product attribute option values can have space characters before and after. This also presents challenges when importing if those values are trimmed en route. More testing required here.

Regards, Tadhg

tadhgbowe commented 6 years ago

Hello. An update from me. I've been doing extensive testing with the product import "configurable_variations" column and what happens if the super attribute option value contains a "|", "," or "=". All three will cause problems.

But I've made a discovery. You don't need to actually have a super attribute value specified. Here's an example - this is what we're used to seeing:

sku=Yellow34,size=34,color=Yellow|sku=Yellow36,size=36,color=Yellow

You only need this:

sku=Yellow34,size=,color=|sku=Yellow36,size=,color=

So, there's not much point fixing a problem when the original values are not actually needed.

The original issue listed at the top is actually linked to custom options i.e.

Error when import product with option label which contains symbols "," (coma) maybe doesn't work with others separator symbols (|,=)

So this still remains a problem I think (my next task). I got slightly side tracked with my other comments above.

Cheers Tadhg