Magento – Possible to link to product that has multiple URL Keys for different store views? (multilingual)

languagemultistoreproductstore-view

I am setting up a Magento shop which has three languages:

  • DE (German)
  • EN (English)
  • JP (Japanese)

We have set up each language as a separate shop with different text/info etc in their appropriate languages.

We have also set up unique URL Keys so that the URLs are in their appropriate languages. The problem is, we need to link to products from another portion of the website which is run by WordPress.

The issue we have, then, is that we can't seem to find a way to link to a product and have it display in its appropriate language as any full URL with the corresponding URL key will go only to that language/store view.

eg:

'http://storedomain.com/en/product-blue.html'

vs

'http://storedomain.com/de/product-blau.html'

Is there any way to have a generic link to the product which will cause Magento to then see which store the user currently has set as default (in the 'store' cookie) and redirect accordingly?

Best Answer

The following approach might be not very SEO friendly but with different URL keys I don't see any SEO friendly one.

You can setup a proxy page like this:

<?php

require_once 'app/Mage.php';
umask(0);

Mage::run();

$_product = Mage::getModel('catalog/product')->load((int)$_REQUEST['id']);
if ($_product->getId()) {
    header('Location: ' . $_product->getProductUrl());
}

Then in your WP you can just link to this file specifying product ID as _GET parameter.