Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Language selection doesn't last


Name Name

Recommended Posts

Hi

I've a shop with 3 different languages. Finnish is the default language, because most of the users use finnish. But then there's english and swedish, which are working fine. The problem is that when you select another language, and click to login page for example, the language switches back to default language. Cookie problem I guess?

My configure.php looks like this:

<?php
 define('HTTP_SERVER', 'http://u31830.shellit.eu');
 define('HTTPS_SERVER', 'http://u31830.shellit.eu');
 define('ENABLE_SSL', false);
 define('HTTP_COOKIE_DOMAIN', 'u31830.shellit.eu');
 define('HTTPS_COOKIE_DOMAIN', 'u31830.shellit.eu');
 define('HTTP_COOKIE_PATH', '/');
 define('HTTPS_COOKIE_PATH', '/');
 define('DIR_WS_HTTP_CATALOG', '/');
 define('DIR_WS_HTTPS_CATALOG', '/');
 define('DIR_WS_IMAGES', 'images/');
 define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
 define('DIR_WS_INCLUDES', 'includes/');
 define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
 define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
 define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
 define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
 define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
 define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
 define('DIR_FS_CATALOG', '/home/u31830/public_html/');
 define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
 define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
 define('DB_SERVER', 'mysql.xxxx.xxx');
 define('DB_SERVER_USERNAME', 'xxxx');
 define('DB_SERVER_PASSWORD', 'xxx');
 define('DB_DATABASE', 'xxx');
 define('USE_PCONNECT', 'false');
 define('STORE_SESSIONS', 'mysql');
?>

The store is located in servers root directory public_html.

Link to comment
Share on other sites

osC picks up the language to use in application_top.php, by asking the browser what language it is configured to use. Could that be what you're seeing? I only use one language, so I can't tell you if osC tries to honor an explicit selection by the visitor (it ought to!).

Link to comment
Share on other sites

Here is my application_top.php section involving language selection. Note that per some post somewhere on this forum, I added || empty($language) near the beginning. You might try that, but I think it's intended for the problem with looking for file .../languages/.php.

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language']) || empty($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'];
 }

Does yours look any different?

Link to comment
Share on other sites

Mine looks like this


// 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'];
 }

I tried modifying the file to look like yours, but no change.

Any idea where the problem might be?

Link to comment
Share on other sites

In your first post, you mentioned changing language, and then going to log in and the language reverts to the default (Finnish). I wonder if setting a non-default language only works once you're logged in?

 

Do you have any other problems that might hint that cookies are not being set and used properly? I've seen suggestions that the cookie domains need to start with a period (.), so maybe try changing them to '.u31830.shellit.eu' and see if it breaks anything, or helps this problem.

 

Have you tried this on other browsers? Maybe the language selection doesn't work on Chrome?

Link to comment
Share on other sites

All the other cookie stuff seem to work, but the language won't work even if I log in. I changed the cookie paths to .u31830.shellit.eu, nothing happens. BUT. That address is only used for host transfers, becuase the domain will be transferred when everythings up and running. so any ideas?

Link to comment
Share on other sites

The language doesn't "stick" with Chrome because your links are all wrong.

 

In your Admin, set 'Use Search-Engine Safe URLs (still in development)' to false.

 

Save it.

 

Sometimes you have to set 'Use Cache' to false to see any change.

 

For example when you click the english language icon to switch the link is:

 

hxxp://u31830.shellit.eu/index.php/language/en

 

When it should be:

 

hxxp://u31830.shellit.eu/index.php?language=en

 

If you do what I said it will correct the links.

 

On my Wife's machine (I don't use Chrome nor is it installed) if I manually correct the link in the browser address bar the language changes and stays changed.

 

Your mileage may vary....

:huh:

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...