On the old Virtuemart the table 'jos_vm_product_relations' is used for the product relations information.
And in Virtuemart 2.0 the table 'j25_virtuemart_product_customfields' is used . this table also contains dates and time of the entry. So you may want to change this in the script I have written here.
You'll need to put you mysql details in a /includes/config.php file .
Apart from that it should help you as long as all the product id's have stayed the same in your transfer.
#######
And in Virtuemart 2.0 the table 'j25_virtuemart_product_customfields' is used . this table also contains dates and time of the entry. So you may want to change this in the script I have written here.
You'll need to put you mysql details in a /includes/config.php file .
Apart from that it should help you as long as all the product id's have stayed the same in your transfer.
#######
echo "hello world
";
include ("includes/config.php");
// now i need to do a database call and get the list of related products from Virtuemart
$query = "SELECT *
FROM `jos_vm_product_relations` ";
;
$result = mysql_query($query)
or die ("1 st Query failed");
$customfield_id = '1';
while ($row = mysql_fetch_array($result))
{
$product_id = $row['product_id'];
$related_products = strip_tags($row['related_products']);
$related_products_array = explode("|", $related_products);
foreach ($related_products_array as $related_product){
echo "('$customfield_id', '$product_id', 1, '$related_product', NULL, '', 0, '2012-07-15 22:10:01', 62, '2012-07-15 22:10:01', 62, '0000-00-00 00:00:00', 0, 0),
";
$customfield_id++;
}
}
echo "
finished;";
?>
No comments:
Post a Comment