Migrating ivf-embryo.gr from Joomla! to Drupal.

ivf-embryo.gr is Thanos Paraschos' "Embio Medical Center" website. Embio Medical Center is a specialized in vitro fertilisation clinic.

The clinic is one of the most known in Greece and its website is one of the largest in both in content and visitor numbers that was developed and hosted by Netstudio. We joke about it calling it an encyclopedia due to the tremendous amount of articles it contains.

The website was developed in 2007 using Joomla! 1.0.x and in 2009 was transferred to Joomla! 1.5.x. During those 4 years, and while the content's volume was still growing, 2 major reconstructions needed to be done along with numerous fixes and improvements.

Having already witnessed Drupal's advantages over Joomla! (faster loading, solid platform, SEO optimized, expandable), we chose to convert ivf-embryo.gr into a Drupal site. That proved to be way harder than we had anticipated.

The site comprised a staggering 550 elements in its main menu, already translated in 8 languages! The menu was linked to over 4500 pages and also included contact forms, videos, images with enlargement capabilities etc. Also, the whole moving process needed to include precise url migrations (meaning the old joomla! urls should match exactly the new ones) so the site wouldn't lose its ranking in the search engines.

For this project, 5 out of 9 members of our team had to participate and also a partner from the clinic's side. Initially, Yannis installed and set Drupal and the basic modules that we would need. After that, I took up the actual process of moving the content.

Initially, I tried using Drupal Feeds. I succesfully added a large percentage of the content this way by matching Joomla! articles to Drupal nodes. Sadly, at that part, the site's internationalization features kicked in to ruin everything. I had to intervene in Feeds' code in order to extend it and make it support the needs of the particular case. Since time was an issue, I didn't have the luxury to develop a module that would extend Feeds, so I wrote a module from scratch that performed the basic operations we needed. That proved to be more time efficient since we didn't meddle with the multiple cases Feeds is designed to deal with.

Here is a code snipet, using the Drupal API for inserting a Basic page and its translation:

<?php
global $user;

// joomla ID
$joomla_id = 15;

// Choose the node that fits the Joomla ID.
// Having already created a field_joomla_id
$query = new EntityFieldQuery;
$results $query->entityCondition('entity_type', 'node')
  ->
propertyCondition('language', 'el')
  ->
fieldCondition('field_joomla_id', 'value', $joomla_id, '=')->execute();

// Array holding node translations
$ex_translations = array();

// If the node already exists update it
if(!empty($results)){
 
$nid = current($results['node'])->nid;
 
$newnode = node_load($nid);
 
$tnid = $newnode->tnid;
 
$ex_translations = translation_node_get_translations($tnid);
}

// Else create a new one
else{
 
$newnode = new stdClass();
}

$newnode->language = 'el';
$newnode->type = 'page';
$newnode->name = $user->name;
$newnode->title = 'Greek Titme';
$newnode->body[$newnode->language][0]['summary'] = '';
$newnode->body[$newnode->language][0]['value'] = 'Greek content';
$newnode->body[$newnode->language][0]['format'] = 'full_html';
$newnode->field_joomla_id[LANGUAGE_NONE][0]['value'] = $joomla_id;

// prepare the node for saving
$newnode = node_submit($newnode);

// save the node
node_save($newnode);

// For translations, tnid needs to be set
if(empty($ex_translations)){
 
db_update('node')
    ->
fields(array(
     
'tnid' => $newnode->nid,
     
'translate' => 0,
    ))
    ->
condition('nid', $newnode->nid)
    ->
execute();
}

// If translations already exist, update them
if(!empty($ex_translations)){
 
$tnode = node_load($ex_translations['en']->nid);
}
// Else create new ones
else{
 
$tnode = new StdClass();
}

$tnode->type = 'page';
$tnode->uid = $user->uid;
$tnode->title = 'Translated Title';
$tnode->language = 'en';
$tnode->body[$tnode->language][0]['summary'] = '';
$tnode->body[$tnode->language][0]['value'] = 'Translated Content';
$tnode->body[$tnode->language][0]['format'] = 'full_html';
$tnode->field_joomla_id[LANGUAGE_NONE][0]['value'] = $joomla_id;
$tnode->promote = 1;
if(empty(
$tnode->tnid)){
   
$tnode->tnid = $newnode->nid;
}

// Saved translation
node_save($tnode);
?>

On the other side (Joomla!), a component was created that extracted in json format the corresponding information.

<?php
$db
= JFactory::getDBO();

$q = "
SELECT c.id, c.title, c.introtext, c.fulltext, c.created FROM #__content AS c
WHERE state = 1
ORDER BY c.id
"
;

$db->setQuery($q);
$articles = $db->loadObjectList();

$export = array();

foreach(

$articles as $i=>$a){
 
$export[$i]['id'] = $a->id;
 
$export[$i]['title'] = $a->title;
 
$export[$i]['introtext'] = $a->introtext;
 
$export[$i]['fulltext'] = $a->fulltext;
 
$export[$i]['date'] = $a->created;
 
$export[$i]['redirect'] = JRoute::_('index.php?option=com_content&view=article&id='.$a->id);
}
echo
json_encode($export);
?>

That json string was passed into Drupal where the the module we wrote performed the necessary operations in order to create the menus, nodes and translations accordingly and insert them into the database (using the Drupal API of course). The whole process was long and tiresome. After many (many) attempts, many staging servers restores, many words and phrases that for censorship issues Ι will ommit from this text, and many "yiipee's" after the successes, Ι managed to complete the transfer. The information was transferred with great precision and very little needed to be corrected manually.

The next issue we needed to tackle was images. They were manually added in Drupal's "files" folder (where they would normally be saved by Drupal). Then, another module was created who's job was to deal with the display of the images using lightbox and dynamically generate thumbnails.

Last but not least, I was left with the url matching. Fortunatelly, here the solution was rather obvious. We used Drupal Redirect (http://drupal.org/project/redirect) and chose to redirect instead of copying the paths. The reason is that Drupal handles urls brilliantly with pathauto and we wanted it to stay that way.

That's where my part ended. George made the last correction on the blocks and menus while Olga performed corrections and revisions on the content. Lastly, Panagiotis who manages our clients' Google campaigns, had to alter the landing pages' urls in the ad texts.

Finally, the website runs on Drupal! You can visit it at http://www.ivf-embryo.gr. It's faster than ever since it uses Drupal 7 caching. Everyone here at Netstudio and most importantly the client are very pleased with the migration and we can already see the positive outcome from the better ranking in Google's results!

Comments

Nice article! I am in the process of doing exactly the same (but without the multilingual part)

I would like to ask how you dealt with the urls redirection. I can redirect the old urls like index.php?option=com_content&view=article&id=JoomlaID to node/DrupalID

but how can you redirect joomla-core-SEF-url to node/DrupalID? The solution should be on the joomla side but could not find it...

Thanks!

I would suggest setting up redirections from both the SEF and non-SEF url's to the new Drupal url's.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Email addresses will be obfuscated in the page source to reduce the chances of being harvested by spammers.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Testimonials

Download Flash Player.

"Web Design" or... Effective Web Design?

10 Steps for a Successful Online Store

WeLoveToys.gr - Ε-Commerce on Joomla

Newsletter

Subscribe to our FREE internet marketing newsletter.