cancel
Showing results for 
Search instead for 
Did you mean: 

Import content into Text Area attribute field from a CSV file

SOLVED

Import content into Text Area attribute field from a CSV file

Hi - I have added a new Text Area attribute on each product to capture notes for admin use only.

 

After adding 1 note manually, I can see in the table 'catalog_product_entity_text' that this field has an attribute ID of 390

 

I have a CSV file that I wish to import which contains 2 fields only - 'sku' and 'notes'. 

 

I know that this is complex but can anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Import content into Text Area attribute field from a CSV file

I sorted this.

 

I created a new table named 'catalog_product_entity_temp' with this structure.

 

Image 2_cr.png

 

I imported my csv file into the 'catalog_product_entity_temp' table using the phpAdmin import facility - see: https://phoenixnap.com/kb/import-csv-file-into-mysql

 

I then ran this SQL script in phpMyAdmin to populate the entity_id for the products based on the SKU:

 

UPDATE catalog_product_entity_temp
        SET catalog_product_entity_temp.entity_id = catalog_product_entity.entity_id,
        FROM catalog_product_entity, catalog_product_entity_temp
        WHERE catalog_product_entity.sku = catalog_product_entity_temp.sku

 

The 'catalog_product_entity_text' was then updated with the Notes using this SQL code ensuring that 'Enable foreign key checks' is disabled :

 

INSERT INTO catalog_product_entity_text (value_id, attribute_id, store_id, entity_id, value)
        SELECT value_id, attribute_id, store_id, entity_id, notes FROM catalog_product_entity_temp

 

 

View solution in original post

2 REPLIES 2

Re: Import content into Text Area attribute field from a CSV file

Hi - maybe I didn't make myself clear.

 

I already have a delimited file. I need to import this into Magento.

 

My problem is that I only have the SKU as a reference point.

 

The SKU's are in the table 'catalog_product_entity'

 

The note contents are in the table 'catalog_product_entity_text'

 

It looks like they are joined on the 'entity_id' record.

 

Do any other tables need updating?

 

What is the exact code I need to use to import?

Re: Import content into Text Area attribute field from a CSV file

I sorted this.

 

I created a new table named 'catalog_product_entity_temp' with this structure.

 

Image 2_cr.png

 

I imported my csv file into the 'catalog_product_entity_temp' table using the phpAdmin import facility - see: https://phoenixnap.com/kb/import-csv-file-into-mysql

 

I then ran this SQL script in phpMyAdmin to populate the entity_id for the products based on the SKU:

 

UPDATE catalog_product_entity_temp
        SET catalog_product_entity_temp.entity_id = catalog_product_entity.entity_id,
        FROM catalog_product_entity, catalog_product_entity_temp
        WHERE catalog_product_entity.sku = catalog_product_entity_temp.sku

 

The 'catalog_product_entity_text' was then updated with the Notes using this SQL code ensuring that 'Enable foreign key checks' is disabled :

 

INSERT INTO catalog_product_entity_text (value_id, attribute_id, store_id, entity_id, value)
        SELECT value_id, attribute_id, store_id, entity_id, notes FROM catalog_product_entity_temp