Magento2: Import data 2.2.6 Value for 'product_type' attribute contains incorrect value

Created on 22 Nov 2018  路  23Comments  路  Source: magento/magento2

Preconditions (*)

  1. magento 2.2.6 (vanilla instance)

Steps to reproduce (*)

  1. create an attribute with code product_type http://i.prntscr.com/AwUJuhizQKatBwNwRa1S7Q.png with type: dropdown scope: global sortable, comparable: no
  2. add it to a family and create a product.
  3. go to import profiles download sample file then reimport sample file

Expected result (*)

  1. [Screenshots, logs or description]
  2. import should be completed

Actual result (*)

  1. Value for 'product_type' attribute contains incorrect value, see acceptable values on settings specified for Admin in row(s): 1, 2, 3, 4, 5, 6
    http://i.prntscr.com/lsI-FNJnTzO0gEttdZp1wA.png
  1. Also reproduced on earlier versions.
Catalog ImportExport Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.2.x Reproduced on 2.3.x

Most helpful comment

@ankit-sf i have done the same thing..i disallowed that attribute to be created in magento.to disallow that attribute being created will be the best option.

All 23 comments

Hi @ankit-sf. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • [x] Summary of the issue
  • [ ] Information on your environment
  • [ ] Steps to reproduce
  • [ ] Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@ankit-sf do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • [ ] yes
  • [ ] no

@magento-engcom-team give me 2.2.6 instance

Hi @ankit-sf. Thank you for your request. I'm working on Magento 2.2.6 instance for you

Hi @ankit-sf, here is your Magento instance.
Admin access: https://i-19346-2-2-6.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

yes, i confirm that i was able to reproduce the issue on vanilla Magento instance following steps to reproduce

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [x] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
  • [x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [x] 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [x] 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [x] 6. Add label Issue: Confirmed once verification is complete.

  • [x] 7. Make sure that automatic system confirms that report has been added to the backlog.

Hi @ankit-sf why you think this is a bug? if you add some aditional atributes you need to add this to your csv file, so sample csv is not working any more, if you add some additional attributes in default attribute set. this is not a bug.

no that's not the case. because newly added custom attributes is not required field.
the issue is that after adding a field, any CSV import doesn't work without that attribute and there is an error.

@ankit-sf This what i'm talking about, you need to use your custom attribute set, not default, you set VALUE is not required, but not an attribute, if you add this to you custom attribute set you dont have an error.

@ankit-sf in sample csv file
selection_217

@engcom-backlog-nazar i'll check and revert in some minutes

@engcom-backlog-nazar Issue exists
Although it's clear in description above, i am rephrasing issue.

Case 1: no issue with code other than product_type

step 1: on vanilla m2 instance, create attribute (dropdown, not required) with code like test_select
step2: add it in default attribute set

  1. goto Import download sample file reimport it.
    Result: everything works fine

Case 2: Issue with code product_type

step 1: on vanilla m2 instance, create attribute (dropdown, not required) with code product_type
step2: add it in default attribute set

  1. goto Import download sample file reimport it.
    Result: Error message shows Value for 'product_type' attribute contains incorrect value

@ankit-sf thanks now clear, this issue occurs only with attribute code product_type with dropdown.

@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-96611, MAGETWO-96612 were created

Hi @hardik-krish. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Hi @ankit-sf,
Magento itself consider product_type as reserve keyword if i am correct.
If you want to see in detail then export product from admin and check CSV file.
you will find there is product type column is already there.
So whenever some one will try to create attribute using product_type code it should not allowed to create attribute and it should be display message like this is reserve keyword.

@hardik-krish maybe you didn't correctly checked issue.
i know there are product_type reserved keyword that is causing issue.

  1. obviously there can solution to implement so that with product_type keyword attributes could not be created.
    but if that's case then you should have created another issue on github with this information. then you should have closed this issue.
    I hope you understand my concern

2nd solution would be to correct it by change in code so correct seperate validation is applied on reserved product_type and custom attribute product_type.

I think you should reopen this issue, because issue exist and also there is no issue corresponding to solution you mentioned.

@hardik-krish @ankit-sf is right there must be validation of the available attributes

@engcom-backlog-nazar @hardik-krish
thank you for referencing related PR. that clears it now.

Now, I have just one minor concern,
we have migrated from magento1 to magento2 have an attribute with product_type code. we have options in attribute and lot of products having this attribute.
since the current solution is to disallow attribute_code with product_type.
what implementation we should do on magento2 when updating magento2 to latest patch so that our data is relevant.
these solutions i can think of:

  1. change code of attribute, but by browser UI it is disabled, so maybe change by db. (but can break things)
  2. delete attribute and create another one with same data and reassign in products (lot of work since lot of products)

so I just have a suggestion (it may not be relevant)
Instead of disallowing product_type code in the attribute.
correct it by the change in code so correct separate validation is applied on reserved product_type and custom attribute product_type. may be i can help with code and do a PR. this way it would not break data of customers already having product_type attribute code.

@ankit-sf,

correct seperate validation is applied on reserved product_type and custom attribute product_type

This totally does not make sense.

What kind of problem are you trying to solve by attribute named product_type? It is obviously quite confusing to have such attribute taking into account "product type" already has special meaning in Magento.

ok then disallow product_type is the best option. thanks.

@ankit-sf i have done the same thing..i disallowed that attribute to be created in magento.to disallow that attribute being created will be the best option.

Hi @ankit-sf. Thank you for your report.
The issue has been fixed in magento/magento2#19408 by @GovindaSharma in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.1 release.

Was this page helpful?
0 / 5 - 0 ratings