Home Magento Guide

Drupal to Magento integration, simple link tweak with multilingual site

30 September 2009 One Comment

Drupal to Magento integration, simple link tweak with multilingual site

I see my coworker and friend Željko Prša made a nice little post on Adding a new language in Magento so I figure I’ll jump with a little Drupal to Magento integration trick concerning link issues and multilingual sites. Here is a piece of code you can use in your Drupal templates to do the proper switching from Drupal site to Magento while keeping the selected language of site. Note, this tweak assumes you have the desired language setup on both Drupal and Magento side.

This part goes to some of your Drupal theme file

</p>
...
global $language ;
$lname = ($language->language == null) ? 'en' : $language->language; /* like "en", "de" */
$storeView = null;
if($lname == 'de') { $storeView = '?___store=german&amp;amp;amp;amp;___from_store=english'; }
??>

</p><p style="text-align: left;"><a id="main_menu_shop" href="<?php echo 'http://'.$_SERVER['HTTP_HOST'].base_path() ?>shop/index.php/someProductLink.html< ?php echo $storeView ?>">Shop</a>
...
<p style="text-align: left;">

Note the $storeView variable; GET ___store holds the value of code name of the view you assigned in Magento, while GET ___from_store variable is used as helper to Magento inner workings. You can basically omit the other one. Your links to Shop from Drupal to Magento should now activate the proper language, the same one you have active on Drupal side.

By Branko Ajzele from Inchoo.net

Related posts:

  1. Adding a new language in Magento
  2. Affiliates for all – Magento integration
  3. How to use WordPress home page in Magento home page (CMS page)
  4. Simple random banner rotator in Magento using static blocks
  5. Adding simple Tweet this for Magento products

One Comment »

  • begawan said:

    Nice post! …

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Security Code: