You are hereBlogs / willhall's blog / Migration of OsCommerce Products to Node Products: 2

Migration of OsCommerce Products to Node Products: 2


By willhall - Posted on 09 March 2010

Following the uploading of products to one product database within phpmyadmin/mysql root, you will now have a Drupal database with a new table named 'products' within it. You can then use the table wizard module to expose the table to the migrate module and draw relationships between the 'products' and 'uc_products' database table.

I have added another little script which runs almost the same process as the migrate module, however, this may need to be edited to run successfully:

<?php
$ubercart_database = 'uberdrupal_tensor';

mysql_connect('localhost', 'admin', 'sheik') or die('Cannot connect to MySql');
mysql_select_db($ubercart_database) or die('Cannot connect to database');

$sql_attributes = 'select * from products';
$query_attributes = mysql_query($sql_attributes);

$i = 1; //starting nid

while($result_attributes = mysql_fetch_assoc($query_attributes)){
$model = $result_attributes['products_model'];
$price = $result_attributes['products_price'];
$weight = $result_attributes['products_weight'];
$length = $result_attributes['products_length'];
$width = $result_attributes['products_width'];
$height = $result_attributes['products_height'];

$update_uc_products = "update uc_products set model = '$model', list_price = $price, cost = $price, sell_price = $price, weight = $weight, weight_units = 'kg', length = $length, width = $width, height = $height, length_units = 'cm', pkg_qty = 1, default_qty = 1, ordering = 1, shippable = 1 where nid = $i";
echo $i;
$i++;

if(!empty($update_uc_products)){
echo $update_uc_products.'';
mysql_query($update_uc_products);
}
}

@willhallonline

  • exasperated at poor connections, may remove and reinstall everything! 10 hours 49 min ago
  • Government sticking to IE6 http://bit.ly/ceMrg9 "more cost effective in many cases to continue to use IE6" (what?!) 13 hours 16 min ago
  • still the mail server continues to frustrate 13 hours 23 min ago
  • feeling positive today, gonna destroy this damned mail server 18 hours 31 min ago
  • where are the open source business analysts who can help out with the actual running of companies, not just make a website for them 18 hours 32 min ago