VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: LAP0109 on January 26, 2015, 12:12:20 PM

Title: sql insert statement for inserting a new product
Post by: LAP0109 on January 26, 2015, 12:12:20 PM
Hey

For my shop i need to insert products via the tables on the sql server. So i need to insert them via a sql statement.

Can anybody show me the correct sql insert statment? I want to insert the product id, product name, product description, price, category, image and amount.

I am using virtuemart version 2.

Kind regards
Title: Re: sql insert statement for inserting a new product
Post by: GJC Web Design on January 26, 2015, 22:25:13 PM
it is a multi join statement as you need at a min. 5 + tables

products, p prices, p cats, p lang, p medias, p product_medias, p manufactuers -- extend if shopper groups, taxes, customs

so not easy -- if I have to do it I use a script to do it table by table - or dig in the product model file to see how it's done
Title: Re: sql insert statement for inserting a new product
Post by: AH on January 27, 2015, 09:37:06 AM
Yes it is tricky!!

You may want to look at using a CSV import, where most of the hard work of importing has been done

CSVI

http://www.csvimproved.com/en/ (http://www.csvimproved.com/en/)
Title: Re: sql insert statement for inserting a new product
Post by: LAP0109 on January 28, 2015, 16:06:45 PM
No csvi won't help me, because i don't want to add products via the backend, i want to do this via an application, so i really need this sql inserts please?

Or has anyone of you an other plan how i can make this?

Thank you so far
Title: Re: sql insert statement for inserting a new product
Post by: GJC Web Design on January 28, 2015, 16:11:14 PM
As we said - it is complex - I have built scripts as commercial jobs for updating VM's tables directly from xml, csv etc etc

the script can easily run to 700+ lines of code

if you can't code then.....  Hutson's suggestion applies - download csvi and see how he does it -- the queries are the same

Title: Re: sql insert statement for inserting a new product
Post by: AH on January 28, 2015, 17:20:14 PM
Or you can google

Virtuemart Product management and see what appears - top link might be of some use!!