Post by jamesswift » Fri Oct 05, 2018 5:05 pm

My problem is that my main page is onepage with only link to several stores in different languages but that main page is set to english and when click on some other store get the language from the default store not the language itself:
mytore.com -> English
mystore.com/gr -> Greek
mystore.com/ro -> Romanian
...

When visiting mystore.com the logo is seen of the store and several options for countries that we work and want when it is clicked on the country that want to open that store in the language set in the admin panel, for mystore.com/gr to be Greek.
But when visit at first place mystore.com the browser save cookie with language content EN and then all other sub stores open in that language.

The solution for 3.x is discussed is in this forum topic: /viewtopic.php?p=705164#p705194 which does not work on OC 2.3.0.2. I did not find any working solution for this.

Maybe will help if make only language cookie to be expire in less then 1 sec or just make to not store that cookie?
Please if someone can help
:P
james

Newbie

Posts

Joined
Fri Oct 05, 2018 4:53 pm

Post by straightlight » Sat Oct 06, 2018 8:27 pm

Maybe will help if make only language cookie to be expire in less then 1 sec or just make to not store that cookie?
Not a solid solution since the time delay interval still applies between the time the cookie was created versus the delayed time that the cookie needs to be expired.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ocmta » Thu Oct 11, 2018 7:47 am

Assuming you use openCart's multistore feature to create different stores, and then select different languages for them in admin - settings - local - language, you can probably do this: edit file catalog/controller/startup/startup.php, find this line:

Code: Select all

if (!array_key_exists($code, $languages)) {
and replace it with this:

Code: Select all

if (true || !array_key_exists($code, $languages)) {
Similar for currency, in the same file find:

Code: Select all

if (!array_key_exists($code, $currencies)) {
and replace with:

Code: Select all

if (true || !array_key_exists($code, $currencies)) {

Extensions for affiliates (openCart 1, 2, 3):
Advanced Multi Level Affiliate System
Customer and Affiliate Accounts Combined into one Account
Affiliate Tracking with Coupons
Discount for Referred Customers - Order Total
Type Tracking Code
Mass Pay
Affiliate Transactions for openCart 3
Affiliate Pack X - all modules with 40% discount


Active Member

Posts

Joined
Mon Mar 12, 2012 11:21 am


Post by pprmkr » Thu Oct 11, 2018 2:59 pm

jamesswift wrote:
Fri Oct 05, 2018 5:05 pm
My problem is that my main page is onepage with only link to several stores in different languages
...
The solution for 3.x is discussed is in this forum topic: /viewtopic.php?p=705164#p705194 which does not work on OC 2.3.0.2. I did not find any working solution for this.

Maybe will help if make only language cookie to be expire in less then 1 sec or just make to not store that cookie?
Please if someone can help
:P
james
Edit your links on the homepage and add a parameter.
Then in the stores read that parameter to set language.

For that edit catalog/controller/startup/startup.php
Before:

Code: Select all

		if (!array_key_exists($code, $languages)) {
Add:

Code: Select all

		if (isset($this->request->get['language_code'])) {
			$code = $this->request->get['language_code'];
		}
Edit the links and add:

Code: Select all

?language_code=en-gb
for English

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands
Who is online

Users browsing this forum: No registered users and 40 guests