Post by ddpneu » Wed Feb 10, 2016 10:32 pm

Hi,
I want to have multi store for example:
english - http://www.test.com
spanish - http://www.test.es

I want to have two flags - British and Spanish.

I´m in a product page on the domain http://www.test.com/product-page. If I click to Spanish flag, I want to stay on the product but change url to http://www.text.es/product-page and of course change automatically with that language and currency.

Is it somehow possible?

Thanks.

New member

Posts

Joined
Sat Sep 14, 2013 4:54 am

Post by ddpneu » Sat Feb 20, 2016 3:54 am

Hello,

nobody know how can I do that?

New member

Posts

Joined
Sat Sep 14, 2013 4:54 am

Post by artcore » Sat Feb 20, 2016 5:43 am

Hi,
It's certainly possible. I've seen some extensions for this in the market http://www.opencart.com/index.php?route ... /extension or you could post a commercial request in the appropriate forum.
Hope that helps ;)

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by ddpneu » Sat Feb 20, 2016 5:48 am

Hi,

I looked in extensions but couldn´t find anything. The closest was here - http://stackoverflow.com/questions/2931 ... s-opencart but I don´t know how to implement to tested. I would buy some extension if I´d found somothing but no success:-(

New member

Posts

Joined
Sat Sep 14, 2013 4:54 am

Post by artcore » Sat Feb 20, 2016 6:12 pm

Here's a little mod you can use freely.

Using FTP:
Rename catalog\view\theme\default\template\common\language.tpl to language.tpl.original
and copy my version to this folder after renaming the original.

Add or remove domain redirects to this array. On the right hand enter the full url including http(s)
Left hand = 2 char language code. Don't forget quotes, commas,...
$domains = array(
'en' => 'https://google.com',
'fr' => 'http://google.fr',
'de' => 'http://google.de',
//'nl' => 'http://google.nl',
);

any part after the base domain is copied over to the redirect. So make sure the contents are identical.
e.g.
http://en.ilithemes.com/index.php?route ... ry&path=18 original page from where the visitor clicks the NL Language
http://nl.ilithemes.com/index.php?route ... ry&path=18 This better have the same category + matching id

When using SEO keywords, it shouldn't matter as OC doesn't have multilingual SEO.
Hope you find it useful. It comes without support and guarantees and you can't claim any rights

Here's the code so you can see it without downloading

Code: Select all

<?php if (count($languages) > 1) { ?>
	<div class="pull-left">
		<div class="btn-group">
			<button class="btn btn-link dropdown-toggle" data-toggle="dropdown">
				<?php foreach ($languages as $language) { ?>
					<?php if ($language['code'] == $code) { ?>
						<img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" title="<?php echo $language['name']; ?>">
					<?php } ?>
				<?php } ?>
				<span class="hidden-xs hidden-sm hidden-md"><?php echo $text_language; ?></span> <i class="fa fa-caret-down"></i></button>
			<ul class="dropdown-menu">
				<?php foreach ($languages as $language) { ?>
					<li><a href="<?php echo getRedirect($language['code']); ?>"><img src="image/flags/<?php echo $language['image']; ?>" alt="<?php echo $language['name']; ?>" title="<?php echo $language['name']; ?>"/> <?php echo $language['name']; ?></a></li>
				<?php } ?>
			</ul>
		</div>
	</div>
<?php } ?>
<?php

	function getRedirect($code) {

		if (empty($code)) {
			$code = 'en';
		}

		$domains = array(
			'en' => 'https://google.com',
			'fr' => 'http://google.fr',
			'de' => 'http://google.de',
			//'nl' => 'http://google.nl',
		);
		if (array_key_exists($code, $domains)) {
			parse_str($_SERVER['QUERY_STRING'], $vars);
			$query = http_build_query($vars);
			return $domains[$code] . $_SERVER['SCRIPT_NAME'] . '?' . $query;
		}
		else {
			return false;
		}
	}

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by ddpneu » Tue Feb 23, 2016 2:30 am

Hi,
thanks for that.

New member

Posts

Joined
Sat Sep 14, 2013 4:54 am

Post by elizaveta_taranik » Tue Mar 11, 2025 4:04 pm

If you're looking for a solution to assign unique domains to different languages in a multistore setup, check out our Language-Based Domain Switcher for OpenCart 3.x. It ensures that each domain is served in only one language and allows switching stores by changing the language

Language-Based Domain Switcher for Multistore OpenCart 3.x

Let me know if you have any questions!

Elizaveta
Image Partneris.lv - opencart web site development and support


User avatar

Posts

Joined
Thu Mar 06, 2025 8:30 pm
Who is online

Users browsing this forum: No registered users and 20 guests