Jump to content

Multi language store with unique domains: multistore way?


Recommended Posts

Hello all,

I have a fresh install of prestashop 1.6 and I'm learning by doing..

 

For our company we need a multi language shop. Each language needs it's own URL (www.mydomain.de, www.mydomain.com, www.mydomain.nl). Its preferred that customers can still switch between the languages with a flag in topbar, but language should direct to the unique URL of that language, not to www.defaultdomain.nl/de or so. 

 

So I set up a 3 stores: NL, DE, ENG. With this post ( http://www.prestashop.com/forums/topic/200923-solved-multishop-one-language-per-multishop/ ) I gave every store it's default language: location --> config --> multistore YES --> set language per store.

 

The next thing would be setting an URL per shop so I can test it. Did not do this yet. But I did find out that the flag for switching between languages in topcorner (front end) dissapeared. Also I found out that on the product page you can still switch between all 3 languages next to text, even though I have clearly chosen 1 specific store (NL) of the three multistores. I took a picture of this situation; its attached. Would it not be correct if only the NL text can be edited when switched to NL store?

 

Am I heading in the right direction?  :rolleyes: Advice is welcome:-)

 

Cheers,

Mjonglang - Netherlands

 

 

 

 

post-877455-0-34923000-1416730935_thumb.jpg

Link to comment
Share on other sites

The languages  you see in the product are the languages installed, not the languages of the shop.

That is the reason you see the three and not only the shop frontend language.

 

As you are going to have the same products on every page, you have only once the product and translated to all languages.

 

Best regards.

Link to comment
Share on other sites

Hi there,

Thanks Miguel86 for your reply,

 

How to get my choose-your-language menu back on frontend for customers? Each language directing to unique domain.

 

Settings:

-3 shops (NL, DE, ENG) under shop group name "default" are activated

-3 languages are installed, each language is associated with one shop

 

Because each shop only has one language the choose-your-language menu (frontend) dissapears, how to get it back?

 

Cheers,

Jan

Edited by Mjonglang (see edit history)
Link to comment
Share on other sites

  • 3 years later...

Mjonglang hope you found the answer for this question, but if no, here you have what I got after hours of testing and suffering:

You are now setting a multi-store instead of a multi-language one so it will affect the way you manage the "ps_languageselector" module, this module should be transform from showing the list of languages to shows a list of available shops, as this override of the module shows:

<?php

use PrestaShop\PrestaShop\Core\Module\WidgetInterface;

if (!defined('_PS_VERSION_'))
	exit;

class Ps_LanguageselectorOverride extends Ps_Languageselector implements WidgetInterface
{

	public function install()
	{
		if (!parent::install() || !$this->registerHook('XXXXXX'))
		  return false;
		return true;
	}

	public function getWidgetVariables($hookName = null, array $configuration = [])
	{
		$id_shop = (int)$this->context->shop->id;
		$id_group = (int)$this->context->shop->id_shop_group;
		$shop = new Shop($id_shop);
		$shopsList = $shop::getShops(false, $id_group);

		foreach ($shopsList as $index => $currShop) {
			$shopsList[$index]['lang'] = Language::getLanguages(true, $currShop['id_shop'])[0];
		}

		return array(
			'shopsGroup' => $shopsList,
			'currentShop' => $id_shop
		);
	}

	public function hookDisplayXXXXXX($params)
	{
		$shopsList = $this->getWidgetVariables();

		if (1 < count($shopsList['shopsGroup'])) {
			$this->smarty->assign($shopsList);
			return $this->fetch('module:ps_languageselector/ps_languageselector.tpl');
    }

    return false;
	}

}

This code should be paste on your overrides folder and change the hook XXXXX to your desired:
override\modules\ps_languageselector\ps_languageselector.php

And it is based on my custom template.tpl to show flags inline, so from here you can modified it:

 <div id="mod-ps-languageselector">
  <h4>{l s='Language:' d='Shop.Theme.Global'}</h4>
  {if isset($shopsGroup)}
    {foreach from=$shopsGroup item=shop}
      <a href="http://{$shop.domain}" class="{if $shop.id_shop == $currentShop}active{/if}">
        {if isset($shop.lang.id_lang)}
          <img src="/img/l/{$shop.lang.id_lang}.jpg" alt="{$shop.lang.language_code}" title="{$shop.lang.name}" />
        {else}
          <img src="/img/l/none.jpg" alt="Flag no found">
        {/if}
      </a>
    {/foreach}
  {/if}
</div>

Paste here: themes\classic\modules\ps_languageselector\ps_languageselector.tpl

Edited by pabloMarch (see edit history)
Link to comment
Share on other sites

fyi domain by language is in my humble opinion voooodooooo!

how does language have anything to do with domain?

when multiplexing same content across multiple domains using a 1 gTLD and 1+ ccTLD, then domain is determined by search engine and visitors 'country'.....

so if I have .com/.fr/.de  and I'm in France, then I  would most likely be directed by search engine to .fr

that is entire point of having ccTLD's!

so what happens when visitor is in .de but wants french language,  in all these voodoo solutions they would be directed to .fr....when .de was correct in the first place.

now try to work your way through what a search engine is going to see when indexing........so bot enters one of non en default domains,  it's redirected to en domain?  I can shoot so many holes in that scenarios....

 

if anyone reads this....you should know basing domain from language is BAD......just because there are modules or hacks to do so does not make it a good idea.....it's not.

localization is not about 'guessing'.....stop guessing

 

 

Edited by El Patron (see edit history)
  • Like 1
Link to comment
Share on other sites

  • 5 months later...

To actually rank high in the country of your extension you should actually have a domain for each extension, and this is out of the box available in Prestashop.
1: create a multistore per url (domain.com, domain.fr, domain.de etc..) 
2: only activate the language that is needed for that specific domain.

Or simply use this module: https://addons.prestashop.com/en/international-localization/49386-language-per-domain.html

Edited by Inform-All (see edit history)
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...