Wednesday, Mar 10, 2010
The process of migrating Oscommerce to Drupal Ubercart, does involve a few processes, however, the advantages are numerous. Check out http://www.ubercart.org/drupal-ecommerce and http://groups.drupal.org/node/8096 for some data about why Ubercart/Migrating from Oscommerce. Personally I feel that the codebase of oscommerce has become very outdated and is no longer running to the potential it could. Alongside this, the Drupal project is growing and Oscommerce shrinking, with a large proportion of new modules being produced for Drupal/Ubercart. ...
Sunday, Nov 1, 2009
Just been hacking away at this to get the idea across of migrating and validating data from one database into the Drupal core (Drupal 6). It relies on the user having created a content type of news from CCK.
<?php mysql_connect('localhost', 'user', 'password') or die('Cannot connect to MySql'); mysql_select_db('database') or die('Cannot connect to database'); // get the required data from the database $sql = 'select * from tableName'; $query = mysql_query($sql); // give it a timestamp $unixTimestamp = 1230800640; //starting unix timestamp $increment = 1012745; //could be replace by a rand() //beginning of the mysql insert sql queries $insertToNode = "INSERT INTO `node` (`nid`, `vid`, `type`, `language`, `title`, `uid`, `status`, `created`, `changed`, `comment`, `promote`, `moderate`, `sticky`, `tnid`, `translate`) VALUES "; $insertToNodeCommentStats = "INSERT INTO `node_comment_statistics` (`nid`, `last_comment_timestamp`, `last_comment_name`, `last_comment_uid`, `comment_count`) VALUES "; $insertToNodeRevisions = "INSERT INTO `node_revisions` (`nid`, `vid`, `uid`, `title`, `body`, `teaser`, `log`, `timestamp`, `format`) VALUES "; //get the total number of rows $totalRows = mysql_num_rows($query); $startNid = 3; // the first Node id (Nid) to be added $userUid = 1; // the id of the user (1 = admin) // create the insert queries while($result = mysql_fetch_assoc($query)){ // sanitise strings ready for insertion $headline = mysql_real_escape_string($result['headline']); $content = mysql_real_escape_string($result['content']); $snippet = mysql_real_escape_string($result['teaser']); // create looping additois to database $insertToNode = $insertToNode. ...
Connect on LinkedIn. Follow me on Twitter. Grab the RSS Feed