Post by quetza » Wed Dec 12, 2007 10:32 pm

Other people may also want to script the addition of products or images directly into the database without going through the admin interface. I'll add the SQL statements as I figure them out.

To add images directly to the database
Images are stored in the image directory. In order to make a new image available to OpenCart, you need to:
1) Upload the image to the image directory
2) Add the filename to the image table
3) Add the image description to the image_description table

To add the filename to the image table, use something like:
INSERT into image (image_id, filename, date_added) VALUES (100, 'MyImage.jpg', NOW());

To add the image description, use something like:
INSERT into image_description (image_id, language_id, title) VALUES (100, 1, 'My Image Description');

It's VERY IMPORTANT that the image_id matches in the 2 statements. This is the first value and 100 in my example.

Newbie

Posts

Joined
Wed Dec 12, 2007 10:38 am
Who is online

Users browsing this forum: No registered users and 1 guest