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.55k stars 9.32k forks source link

IMPORT: additional_attributes are completely ignored in 2.2.3 #14881

Open ghost opened 6 years ago

ghost commented 6 years ago

Preconditions

In a Magento admin login, we should have custom attributes created.

  1. Navigate to Store>products page: Click on new attribute button, and just add the name of the attribute eg: Cust_Att1. Without any other changes, save the attribute.
  2. Navigate to Store>Attribute Set: Click on the default attribute set record, Drag and drop the color attribute and as well the above created _CustAtt1 attribute. Save the attribute set.

Steps to reproduce

  1. Prepare a CSV file with below content to import it further.

    sku,price,attribute_set_code,product_type,name,additional_attributes
    913352,1,Default,simple,ImprotProd5,"cust_att1=ca_edited,color=Blue"
    917252,1,Default,simple,ImprotProd6,cust_att1=ca_edited

    Note- This above given file data matches according to the above pre condition example data.

  2. Navigate to Admin login > System> Import page.

  3. Select Entity type- product and import behaviour add/update

  4. Select the checkbox - Fields enclosure.

  5. Choose the above created file, click on check data and followed by import.

  6. Navigate to Catalog>products and search with the SKU text - 913352, and open the product.

  7. Check the product's custom attribute value whether that is as per imported file content.

Expected result

Additional attributes should be included along with the other product data.

Actual result

Products get created, but misses to store with the additional attribute column data.

Note: We get to see this issue only when the checkbox Fields enclosure filed is checked while importing in the Import page.

ghost commented 6 years ago

@einicher, thank you for your report. We've acknowledged the issue and added to our backlog.

timbot18 commented 5 years ago

has this been resolved?

i'm having the same issue. i tested 2.1.3 and it worked, upgraded to 2.2.1 and it stopped working. tried in fresh install of 2.3.1 and it is not working. even tried to export the csv, delete the product, and import the csv, but was still ignored.

sergiuionescu commented 5 years ago

I can confirm the same issue occurs on 2.2.9. Is this something that is being addressed?

Thanks.

Pyronerd62 commented 5 years ago

Same on 2.3.2

mlaurense commented 4 years ago

FFS... Seriously, one and a half year later and still not working...

allanminium commented 4 years ago

On 2.3 at the moment. If the attribute field is a dropdown or multi-select, the fields need to be manually added into the system before it will be recognised. Insane.

timbot18 commented 4 years ago

On 2.3 at the moment. If the attribute field is a dropdown or multi-select, the fields need to be manually added into the system before it will be recognised. Insane.

yep. i have hundreds of attributes for my store. tried importing them in sql, which works, but the import process for the csv still ignores them.

allanminium commented 4 years ago

On 2.3 at the moment. If the attribute field is a dropdown or multi-select, the fields need to be manually added into the system before it will be recognised. Insane.

yep. i have hundreds of attributes for my store. tried importing them in sql, which works, but the import process for the csv still ignores them.

From memory, the attributes sit in two different tables, one has the value and an ID, and they other has an ID and some other ID. Does your sql insert take that into consideration?

mlaurense commented 4 years ago

On 2.3 at the moment. If the attribute field is a dropdown or multi-select, the fields need to be manually added into the system before it will be recognised. Insane.

yep. i have hundreds of attributes for my store. tried importing them in sql, which works, but the import process for the csv still ignores them.

From memory, the attributes sit in two different tables, one has the value and an ID, and they other has an ID and some other ID. Does your sql insert take that into consideration?

I can recommend using https://github.com/bigbridge-nl/product-import. It took me a day to get the Magento import working, only to find out it didn't do anything with the attributes... I converted the CSVs I had to XMLs, and within an hour I had all my data imported. Saves you a lot of hassle of inserting in the right tables...

timbot18 commented 4 years ago

From memory, the attributes sit in two different tables, one has the value and an ID, and they other has an ID and some other ID. Does your sql insert take that into consideration?

i believe so. honestly, it's been so long i gave up on this working. IIRC, i inserted them into eav_attribute, eav_attribute_option, and eav_attribute_option_value. i dont have the code handy, must have gotten pissed it didnt work and not save it.

I can recommend using https://github.com/bigbridge-nl/product-import. It took me a day to get the Magento import working, only to find out it didn't do anything with the attributes... I converted the CSVs I had to XMLs, and within an hour I had all my data imported. Saves you a lot of hassle of inserting in the right tables...

i will try this. thanks!

jg-development commented 4 years ago

still on 2.3.3 I got into this problem yesterday for the first time. So from my side this is a +1

ioweb-gr commented 4 years ago

Still on 2.3.4. Just bumped into the issue today.

aampudia commented 4 years ago

This is still an issue on version 2.3.5 p1. is there a fix we can do directly on our installation or something??

magenx commented 4 years ago

2.3.5-p1 imported 15k products, then realized no additional attributes... nice

ioweb-gr commented 4 years ago

I managed yesterday to create an import profile that actually worked by changing the multiple value separator to ~ because I was certain no attribute was using it and also unchecked the enclosure. I was able to import successfully the attributes. Could you guys give it a shot like that?

Of course that means modifying the values in the column too

aampudia commented 4 years ago

@ioweb-gr noup, i doesn't work with my file.... my test file looks like this and doesn't work. only "Aplicaciones" is a multiselect, all others are just text sku,additional_attributes 223995901,"Tipo_de_producto=Sensor de presión,Marca=FRANKLIN,Serie=Sensor SubDrive,Aplicaciones=Comercio~Agricultura~Industria,Garantia=1 año" 225495901,"Tipo_de_producto=Sensor de presión,Marca=FRANKLIN,Serie=Sensor SubDrive,Aplicaciones=Comercio~Agricultura~Industria,Garantia=1 año"

allanminium commented 4 years ago

is there any patch or clue or hint? im really dont have time to debug this :(

I couldn't source a viable long term solution, but I found my quick and dirty fix here - https://magento.stackexchange.com/questions/103934/magento2-programmatically-add-product-attribute-options. I used the last solution which also has a negative score. But damnit, it got the job done at the time.

cenobitz commented 4 years ago

No matter what kind of separator U use CSV import is not working for me tested on fresh install PHP7.1/7.2 with new products manually added and imported demo store... I even exported 1 product from Magento demo store and imported it again and attributes are missing. I've tested even simple text attribute and this is not imported as well... I've wasted so much time for this... I made also tests with one attribute and one value... not working. All attribute values where created earlier in admin... (Magento 2.3.x). Attributes are basic feature for e-commerce and product segmentation. What a shame it;s not working as expected.

seak6adtn59v commented 4 years ago

additional_attributes doesn't work in magento 2.3.5-p1 but it works if I put all the custom attributes as columns, but not via "additional_attributes" field. Please check and provide some fix.

WinstonN commented 4 years ago

Anyone reading this, don't tick the box "Fields enclosure" - leave that unchecked. In my tests, when checking that box, importing additional_attributes would not work

dpanfili commented 3 years ago

Anyone reading this, don't tick the box "Fields enclosure" - leave that unchecked. In my tests, when checking that box, importing additional_attributes would not work

Wow - something that simple resolved the issue for me. Although with my set of data, which includes commas and quotes within HTML of some fields, I'm not 100% sure of the purpose of "Field Enclosure" now.

timbot18 commented 3 years ago

additional_attributes doesn't work in magento 2.3.5-p1 but it works if I put all the custom attributes as columns, but not via "additional_attributes" field. Please check and provide some fix.

i was able to get them imported using this method after using sql (below) to import my attributes.

From memory, the attributes sit in two different tables, one has the value and an ID, and they other has an ID and some other ID. Does your sql insert take that into consideration?

i recently had to import them again, so i took notes of the sql used:

INSERT INTO eav_attribute VALUES (attribute_id | entity_type_id | attribute_code | attribute_model | backend_model | backend_type | backend_table | frontend_model | frontend_input | frontend_label | frontend_class | source_model | is_required | is_user_defined | default_value | is_unique | NULL);

INSERT INTO eav_attribute_option_value VALUES (value_id | option_id | store_id | value | );

INSERT INTO eav_attribute_option VALUES (option_id | attribute_id | sort_order | );

INSERT INTO catalog_eav_attribute VALUES (attribute_id | frontend_input_renderer | is_global | is_visible | is_searchable | is_filterable | is_comparable | is_visible_on_front | is_html_allowed_on_front | is_used_for_price_rules | is_filterable_in_search | used_in_product_listing | used_for_sort_by | is_configurable | apply_to | is_visible_in_advanced_search | position | is_wysiwyg_enabled | is_used_for_promo_rules | is_required_in_admin_store | is_used_in_grid | is_visible_in_grid | is_filterable_in_grid | search_weight | additional_data | );

i used excel to fill in all of the data. it's dirty, but works. obviously you'll have to replace the column names with the actual values you want to insert.

magenx commented 3 years ago

2.4.1 - additional attributes not imported, in any way 👍

Rich07082 commented 3 years ago

Had same issue with clean install of Magento 2.4.1. What i found fixed my problem was when a new attribute was created the default value in the eav_attribute dafault_value cell was blank. Once i changed the cell to 'null' the import of addtional_attributes via csv file worked flawless.

Rich

dinkeronline commented 3 years ago

additional_attributes doesn't work in magento 2.3.5-p1 but it works if I put all the custom attributes as columns, but not via "additional_attributes" field. Please check and provide some fix.

@prashantvictory good that you find it, anyone else having the same problem, separate the attributes in different columns, creating the additional_attributes column was a pain when you have multiple attributes.

perryholden commented 3 years ago

After some local debugging, I found that if a custom attribute is set to not be visible (e.g. catalog_eav_attribute.is_visible is set to 0), then it can't be saved. The import code then just silently ignores these attributes. So if anyone is dealing with this still, here are a few things I would check:

  1. As some recommended above, avoid using the "additional_attributes" column. Just put the attribute name in a column, and add its actual value (e.g. "No" instead of "0"). This is the only way I can get custom attributes to import.
  2. Check to see if the attribute is visible (see catalog_eav_attribute.is_visible), and if not, set the value to 1 (preferably via a script).
  3. Check to see if that attribute is even in the product's attribute set.
magenx commented 3 years ago

dont waste your time here just use full import module from
https://docs.met.tdintern.de/pacemaker/1.3/ce_installation.html

install
composer require techdivision/import-cli-simple

github-jira-sync-bot commented 3 years ago

Unfortunately, not enough information was provided to create a Jira ticket. Please make sure you added the following label(s): Reproduced on 2.4.x, ^Area:.*

Once all required labels are present, please add Issue: Confirmed label again.

github-jira-sync-bot commented 3 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1025 is successfully created for this GitHub issue.

m2-assistant[bot] commented 3 years ago

:white_check_mark: Confirmed by @engcom-Alfa. Thank you for verifying the issue.
Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

richard-parnaby-king commented 3 years ago

I have encountered this issue myself. To recreate: Create a product attribute via the admin panel with a mixed-case attribute code (e.g. Part_Type). At this point it does not matter what case you use in the additional_attributes column (i.e. all lower case, all uppercase, or mixed case to match the attribute code). For this example I shall use mixed-case. In a csv, set the additional_attributes value as Part_Type="Some Value" e.g.

sku,additional_attributes
123,Part_Type="Some Value"

and import the csv. Expected: Magento will populate the attribute "Part_Type" for the product 123 with "Some Value". Actual: Magento does nothing.

My "fix" is to convert the attribute code to lowercase, e.g. part_type. I did this directly via mysql however you could also delete the attribute via the admin panel and recreate it. The csv then becomes:

sku,additional_attributes
123,part_type="Some Value"

and imports correctly.

Long term solution is for magento to only allow lowercase characters in the attribute_code field when creating attributes.

xtremevision commented 2 years ago

Confirmed in Magento 2.3.7. The "additional_attributes" column is totally igored.

abdelkebir commented 2 years ago

The same in Magento 2.3.7-p2.

Nico2P commented 2 years ago

Same problem with version 2.4.3

If the "Field Enclosure" box is checked the import of attributes does not work.

No problem if the option is not checked

isaacdzca commented 2 years ago

Still in Magento 2.4.3

engcom-Alfa commented 2 years ago

@magento give me 2.4.3 instance

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Alfa. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 2 years ago

Hi @engcom-Alfa, here is your Magento Instance: https://05032a3c92af679e8eee7d12ea3b303b.instances.magento-community.engineering Admin access: https://05032a3c92af679e8eee7d12ea3b303b.instances.magento-community.engineering/admin_21cd Login: ee97ea01 Password: 0137cfb7f46e

engcom-Alfa commented 2 years ago

As I cross checked again with 2.4-develop magento code, the issue is still reproducible, hence I edited the description part of this ticket with all the information again in this ticket. Also changing the priority to P1 from P2, since there are many people noticing this issue as per above comments. Thanks for your patience!

0franco commented 1 year ago

Adding has_options=1 did the trick on my case.

has_options=1,myAttr=myValue -> Works ✅ myAttr=myValue -> Ignored