Author Topic: SQL INSERT QUERY  (Read 4156 times)

vixper

  • Beginner
  • *
  • Posts: 3
SQL INSERT QUERY
« on: April 28, 2010, 14:34:11 pm »
Hi, I need to insert products in my virtuemart with a php script.

What I need to insert is:

- Product Name
- Description
- Price
- Image
- Thumbnail

Can anybody help me with the INSERT query I need to use?

Thanks!!!

Svetlio

  • Jr. Member
  • **
  • Posts: 141
Re: SQL INSERT QUERY
« Reply #1 on: April 28, 2010, 16:40:15 pm »
A sample product insert MySQL query is:

INSERT INTO `jos_vm_product` (`product_id`, `vendor_id`, `product_parent_id`, `product_sku`, `product_s_desc`, `product_desc`, `product_thumb_image`, `product_full_image`, `product_publish`, `product_weight`, `product_weight_uom`, `product_length`, `product_width`, `product_height`, `product_lwh_uom`, `product_url`, `product_in_stock`, `product_available_date`, `product_availability`, `product_special`, `product_discount_id`, `ship_code_id`, `cdate`, `mdate`, `product_name`, `product_sales`, `attribute`, `custom_attribute`, `product_tax_id`, `product_unit`, `product_packaging`, `child_options`, `quantity_options`, `child_option_ids`, `product_order_levels`) VALUES
(1, 1, 0, 'P01', 'Type short description', '<p>Type regular description</p>', 'product_thumbnail.gif', 'product_image.jpg', 'Y', '10.0000', 'pounds', '0.0000', '0.0000', '0.0000', '', '', 41, -3600, '', 'Y', 1, NULL, 1204196903, 1221747338, 'Product name', 52, '', '', 2, '', 0, 'Y,N,N,N,N,Y,20%,10%,', 'none,0,0,1', '', '0,0');


If you want to insert the chosen fields you can use the following MySQL query:

INSERT INTO `jos_vm_product` (`product_name`,  `product_desc`, `product_full_image`, `product_thumb_image`) VALUES ('Product name', '<p>Type regular description</p>', 'product_image.jpg', 'product_thumbnail.gif');

The price should be inserted in the jos_vm_product_price table.

Still I will recommend you to insert the products through the VirtueMart admin interface or using a .csv file.

More about the last solution can be found at:

http://kb.siteground.com/article/How_to_export_import_VirtueMart_products.html
SiteGround Technical Support Team Member. Check out our special VirtueMart hosting package

vixper

  • Beginner
  • *
  • Posts: 3
Re: SQL INSERT QUERY
« Reply #2 on: May 11, 2010, 12:42:37 pm »
Thanks for your reply!

I tryied it just yesterday and it works!
The only problem is that if I insert something like "è", "à" or other "special" characters in the virtuemart frontend I found this chars replaced by &egrave; &agrave; etc...

Any idea to solve it?

Thanks

aji123

  • Jr. Member
  • **
  • Posts: 62
    • Joomla Services ,Joomla Development Services India
Re: SQL INSERT QUERY
« Reply #3 on: July 14, 2010, 12:32:49 pm »
Hi ,

Here you have used htmlspecailchars() php script, so you will remove this one and recheck it

Hridoy

  • Beginner
  • *
  • Posts: 1
Re: SQL INSERT QUERY
« Reply #4 on: February 10, 2013, 10:17:19 am »
Hi,
I am searching the query to insert a virtuemart product. Where, in which file, it is written?  Can anyone help me. I want to edit the query there. Thanks !

VirtueMart Forum

Re: SQL INSERT QUERY
« Reply #4 on: February 10, 2013, 10:17:19 am »