Hi: Is there a way to force the language and currency in the URL? If so, what are the parameters?
I ask this because I would like to link to a specific language/currency combination, rather than rely on the requester's browser defaults.
I'm looking for something like this: http://www.mysite.com&language=de&cur=EUR
Thanks!
I ask this because I would like to link to a specific language/currency combination, rather than rely on the requester's browser defaults.
I'm looking for something like this: http://www.mysite.com&language=de&cur=EUR
Thanks!
I use OpenCart 1.5.2.1 at: http://www.alpineultralight.com
Hi Guru: Thank you for your response. I read the posts you linked to and they all said it would work if you append
"&language=de" to the URL.
I tried that before posting this question and it didn't work properly.
This is what I've typed in the URL box of the browser:
http://mysite.com/index.php?language=de
If I changed from English to German, it worked. But if I then entered:
http://mysite.com/index.php?language=en
It doesn't switch back to english.
If I hit the British flag, it will switch back to english.
Was this language in the URL option modified from version 1.5.x? I'm running 1.5.2.1
Thanks again for your willingness to help.
"&language=de" to the URL.
I tried that before posting this question and it didn't work properly.
This is what I've typed in the URL box of the browser:
http://mysite.com/index.php?language=de
If I changed from English to German, it worked. But if I then entered:
http://mysite.com/index.php?language=en
It doesn't switch back to english.
If I hit the British flag, it will switch back to english.
Was this language in the URL option modified from version 1.5.x? I'm running 1.5.2.1
Thanks again for your willingness to help.
I use OpenCart 1.5.2.1 at: http://www.alpineultralight.com
qphoria - you're going to hate me but it simply doesn't work on the OpenCart install I'm working on - 1.5.2.1
I am looking all over the solution for a sign of where it enquires the URL for the language (or indeed the currency) but I simply cannot find it.
It seems crazy for me to write my own function if the Core should be taking care of this already.
Could you please point me to the code where the URL query params are used for setting the lanaguage, then I can reconcile with mine ?
I am looking all over the solution for a sign of where it enquires the URL for the language (or indeed the currency) but I simply cannot find it.
It seems crazy for me to write my own function if the Core should be taking care of this already.
Could you please point me to the code where the URL query params are used for setting the lanaguage, then I can reconcile with mine ?
Ok... I must be missing the blindingly obvious. But ?language=fr simply did nothing and I could find no code that suggested it would (OC 1.5.2.1).
In case it helps others or even myself if this encourages someone able, to shed some light:
I have added my some amendments, after a little battle with the redirect (if the language param exists in the url when you post a new lang choice, the url param was winning), and these are them (feel free to improve or nuke!):
the index.php file:
and the sys/eng/controller.php file
I can only assume my OC files are missing something along the lines of GET["language"] that should exist or my NetBeans find is broken
Any chance someone able can shed some light?
For clairty, solely due to the code above ?language=fr now works and altering the language via the form in the header area continues to work alongside.
In case it helps others or even myself if this encourages someone able, to shed some light:
I have added my some amendments, after a little battle with the redirect (if the language param exists in the url when you post a new lang choice, the url param was winning), and these are them (feel free to improve or nuke!):
the index.php file:
Code: Select all
/*NEW*/if(isset($_GET['language']) && array_key_exists($_GET['language'], $languages)) {
$code = $_GET['language']; $_GET['language'] = null;
} else /*NEW*/if (isset($session->data['language']) && array_key_exists($session->data['language'], $languages) && $languages[$session->data['language']]['status']) {
$code = $session->data['language'];
} elseif (isset($request->cookie['language']) && array_key_exists($request->cookie['language'], $languages) && $languages[$request->cookie['language']]['status']) {
$code = $request->cookie['language'];
} elseif ($detect) {
$code = $detect;
} else {
$code = $config->get('config_language');
}
Code: Select all
protected function redirect($url, $status = 302) {
header('Status: ' . $status);
/*NEW*/
$url = str_replace('&', '&', $url);
$purl = explode('?', $url);
parse_str($purl[1], $gets);
unset($gets['language']);
$url = $purl[0].'?'.urldecode(http_build_query($gets));
header('Location: ' . $url);
/*NEW*/
/*OLD*/header('Location: ' . str_replace('&', '&', $url));/*OLD*/
exit();
}
----
Any chance someone able can shed some light?
For clairty, solely due to the code above ?language=fr now works and altering the language via the form in the header area continues to work alongside.
Ah you are right.. looks like daniel removed it in 1.5.2 here..
http://code.google.com/p/opencart/sourc ... /index.php
Your index.php change is correct. Don't think you need the other change as that was never there before.
I'll talk to him about it
http://code.google.com/p/opencart/sourc ... /index.php
Your index.php change is correct. Don't think you need the other change as that was never there before.
I'll talk to him about it
Hi Qphoria,
are these changes ok? can we go ahead and change our index.php if we want to create links that directly chooses the language for the customers?
Example:
http://mysite.com/index.php?language=de
this will be the link we will post in our german forums for customers to get directly to our store with the german interface.
Anticipated thx
are these changes ok? can we go ahead and change our index.php if we want to create links that directly chooses the language for the customers?
Example:
http://mysite.com/index.php?language=de
this will be the link we will post in our german forums for customers to get directly to our store with the german interface.
Anticipated thx
Qphoria,
I have added the BELOW code to main index.php
saved it and uploaded it ... still if you click on
http://mysite.com/index.php?language=de
it will still show you the ENGLISH version.
Please any help on WHAT to add or what to do?
Anticipated thx
I have added the BELOW code to main index.php
Code: Select all
/*NEW*/if(isset($_GET['language']) && array_key_exists($_GET['language'], $languages)) {
$code = $_GET['language']; $_GET['language'] = null;
} else /*NEW*/if (isset($session->data['language']) && array_key_exists($session->data['language'], $languages) && $languages[$session->data['language']]['status']) {
$code = $session->data['language'];
} elseif (isset($request->cookie['language']) && array_key_exists($request->cookie['language'], $languages) && $languages[$request->cookie['language']]['status']) {
$code = $request->cookie['language'];
} elseif ($detect) {
$code = $detect;
} else {
$code = $config->get('config_language');
}
http://mysite.com/index.php?language=de
it will still show you the ENGLISH version.
Please any help on WHAT to add or what to do?
Anticipated thx
Hi dpit,
thank you for your prompt answer.
1/
Yes if I click on the German flag then the language of the site changes to german
2/
How can I set a debug to see the error?
3/
I must admit I only made the changes to index.php and NOT to "sys/eng/controller.php" file.
Should I retest it with the controller.php changes as well see if the problem lies there?
Thank you again for helping us with this Language issue, since it does make a LOT more sense if you wish to send a customer to a product or page in his language rather then to tell him (and by the way, dont forget to click on the flag..)
thank you for your prompt answer.
1/
Yes if I click on the German flag then the language of the site changes to german
2/
How can I set a debug to see the error?
3/
I must admit I only made the changes to index.php and NOT to "sys/eng/controller.php" file.
Should I retest it with the controller.php changes as well see if the problem lies there?
Thank you again for helping us with this Language issue, since it does make a LOT more sense if you wish to send a customer to a product or page in his language rather then to tell him (and by the way, dont forget to click on the flag..)
I use netbeans against a local copy.
The controller was to support flag usage alongside this.
So it should work now. I think the best thing might be to spit out some debug info to your error log.
I can have a look Sunday if you need help. You will find it quite easy to spit out info to the log though, and thus find out what's wrong.
The controller was to support flag usage alongside this.
So it should work now. I think the best thing might be to spit out some debug info to your error log.
I can have a look Sunday if you need help. You will find it quite easy to spit out info to the log though, and thus find out what's wrong.
Any reason why he didn't like it?Qphoria wrote:It was removed because daniel didn't like it.
Is he planning to provide language-specific SEO keywords (slugs)?
OC2PS
OC 3.0.3.7, vQmod 2.6.2, Journal3 theme
Arcfesték, Csillámtetoválás, Henna
Check out: All my extensions | My FREE extensions
Follow...
I'd like too old one (or a better method) to be introduced again in last Opencart versions!
M
I'd like too old one (or a better method) to be introduced again in last Opencart versions!
M
-----------------------------------------------------------------------
My last mods: Partita IVA e CF | Pro EU VAT Number | Sales Agents | Pricelist Pro
-----------------------------------------------------------------------
dpit's code worked in 1.5.5.1, and both the index.php and the controller.php changes are necessary to get both the url and the language flag buttons working correctly.
I think arames's problem was that he added the index code incorrectly. Only this code is added:
The rest of it is just there to show you were it goes.
I think arames's problem was that he added the index code incorrectly. Only this code is added:
Code: Select all
/*NEW*/if(isset($_GET['language']) && array_key_exists($_GET['language'], $languages)) {
$code = $_GET['language']; $_GET['language'] = null;
} else /*NEW*/
Who is online
Users browsing this forum: No registered users and 97 guests