Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

German IP won't default on english language page


livingplanet

Recommended Posts

I recently received an email from a German customer who said he keeps getting redirected in my store to a German language page (which I currently do not have setup for my store). He claims it's because he has a German ip address and Mysql is choosing to redirect.

 

Has anyone ever heard of a problem like this? If so, how did you fix it?

I'm pretty handy with php so editing code is not a problem. I'd like to direct everyone to the english page and cut out any code (if it exists) that redirects customers to their country pages.

 

Thanks so much,

Mark

Link to comment
Share on other sites

I'd say it's more likely the shop is detecting the browser language and going off that cue.

 

I didn't want to uninstall or delete the language files from the store (truthfully - just because I was afraid of breaking something! :lol: ).

 

So I did the same thing with these code changes:

 

/catalog/includes/boxes/languages.php

 

  while (list($key, $value) = each($lng->catalog_languages)) {
$languages_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> ';

break; // <-- added this line oly!
 }

(That works only if and because engish is the first language).

 

/catalog/includes/application_top.php

 

Old code:

 

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language();

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $lng->set_language($HTTP_GET_VARS['language']);
} else {
  $lng->get_browser_language();
}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
 }

New code:

 

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

$language = 'en';

if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language();

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $language = 'en';
  $lng->set_language($language);
}
//	  $lng->set_language($HTTP_GET_VARS['language']);
//	} else {
//	  $lng->get_browser_language();
//	}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
 }

This worked for me to keep it all in english (even if they append a language to the URL in the browser) without removing or uninstalling any language files.

 

Your milegae may vary.

:blush:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 11 months later...
  • 10 months later...

I'd say it's more likely the shop is detecting the browser language and going off that cue.

 

I didn't want to uninstall or delete the language files from the store (truthfully - just because I was afraid of breaking something! :lol: ).

 

So I did the same thing with these code changes:

 

/catalog/includes/boxes/languages.php

 

  while (list($key, $value) = each($lng->catalog_languages)) {
$languages_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> ';

break; // <-- added this line oly!
 }

(That works only if and because engish is the first language).

 

/catalog/includes/application_top.php

 

Old code:

 

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language();

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $lng->set_language($HTTP_GET_VARS['language']);
} else {
  $lng->get_browser_language();
}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
 }

New code:

 

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {

$language = 'en';

if (!tep_session_is_registered('language')) {
  tep_session_register('language');
  tep_session_register('languages_id');
}

include(DIR_WS_CLASSES . 'language.php');
$lng = new language();

if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
  $language = 'en';
  $lng->set_language($language);
}
//	  $lng->set_language($HTTP_GET_VARS['language']);
//	} else {
//	  $lng->get_browser_language();
//	}

$language = $lng->language['directory'];
$languages_id = $lng->language['id'];
 }

This worked for me to keep it all in english (even if they append a language to the URL in the browser) without removing or uninstalling any language files.

 

Your milegae may vary.

:blush:

 

I have tryed the new code, but in that case I could not use the box with different languages, so I believe the change I report below is more appropriate, we use a kind of "hard coded" default language and then the user can still choose to change language if the language box is activated.

 

Here my code:

 

// set the language
 if (!tep_session_is_registered('language') || isset($_GET['language'])) {

   $language = 'it'; //giangios - line added

   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($_GET['language']) && tep_not_null($_GET['language'])) {       
     $lng->set_language($_GET['language']);
   }
   else {      
     $lng->set_language($language);  //giangios - line added
     //$lng->get_browser_language(); //giangios - line commented out
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...