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';
mysql_connect('localhost', 'admin', 'password') 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);
}
}
Connect on LinkedIn. Follow me on Twitter. Grab the RSS Feed