cancel
Showing results for 
Search instead for 
Did you mean: 

Import content into Text Area attribute field from a CSV file

SOLVED
Highlighted

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
Highlighted

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

3 REPLIES 3
Highlighted

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

  1. Select File » Get External Data » Import. ...
  2. In the Save as Type dropdown box choose Text Files:
  3. Go to the folder in which the tab-delimited file (table1.txt) is located, select the file, and click Import. ...
  4. With Delimited option pre-selected click Next.
  5. A second import wizard dialog should come up.
Highlighted

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?

Highlighted

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