Jump to content

New field added: how to populate database from CSV file


Recommended Posts

Hi,

I've building a cd/lp/dvd shop and I added the field "author" (autor) to the table 'prstshp_product' following the tutorials found on the internet. 

 

 

Now, I want to populate the database with items from a csv file but this field does not appear on the drop-down menu to select the destination. This field doesn't appear on the product list, but I can see it on "Add new product" page.

 

post-1084449-0-57835400-1444123357_thumb.png

 

post-1084449-0-64600500-1444123358_thumb.png

 

Could you give me some hint to solve it?

 

Thanks in advance

Link to comment
Share on other sites

It's sadly more complicated than it seems. If you are okay in uploading the csv 2 times, you can create a small separate script to handle it. The way I'd do it is by using fgetcsv, after uploading the file normally, using a foreach to go through all the lines and creating a sql statement for each. if you disable autocommit, and send over the commit command after like 500 products, you avoid querying the database for each single product

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...