Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

default_language


oscnewbe

Recommended Posts

How can I turn datebase driven 'default_language' into hard coded 'default_language'.

 

Currently I'm running 2 domains (same subjects, but diff. languages) on 2 databases.

I'm able to point both store fronts to one database.

 

But - one problem appears:

 

Search engines only scanning domains in default language, only.

2 stores and 1 database means 1 default language for both stores.

 

Does anyone solved this issue?

Link to comment
Share on other sites

How can I turn datebase driven 'default_language' into hard coded 'default_language'.

 

Currently I'm running 2 domains (same subjects, but diff. languages) on 2 databases.

I'm able to point both store fronts to one database.

 

But - one problem appears:

 

Search engines only scanning domains in default language, only.

2 stores and 1 database means 1 default language for both stores.

 

Does anyone solved this issue?

 

 

the language a site uses is determined in application top.

so even if you have only 1 database (with multiple languages I presume), you can set a default language separate for each site.

Treasurer MFC

Link to comment
Share on other sites

I tried to modify this code piece in ../includes/application_top.php

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

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');
 $current_page = basename($PHP_SELF);
 if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {
   include(DIR_WS_LANGUAGES . $language . '/' . $current_page);
 }

But it doesn't effect the search engine it self. The search engine uses still the default language which is set to "english" in the db.

Perhaps I didn't find the the line in application_top.php.

Link to comment
Share on other sites

PS: I only try to keep meta tag languages (german/english) between .de and .com seperate, when I use one db. Except the search engine issue everything works fine.

Link to comment
Share on other sites

Provided that you have the two language packs fully installed on the one website then the language the user will see will change according to the language set in their web browser e.g. someone whose browser language is German will see the German version of the site, and someone whose browser language is English will see that version.

 

You can even change which logo is displayed in the header by putting a piece of code like this just before the closing php tag before the first table command:

 

if ($languages_id == "1") { $image = "logo1.gif"; }

elseif ($languages_id == "7") { $image = "logo2.gif"; }

else { $image = "logo1.gif"; }

?>

 

Make sure that the language id's match those in your database.

 

Vger

Link to comment
Share on other sites

Thank You for your recommendation

 

I will check it out.

 

I was already thinking about different images depending of chosen languages.

Your shop "Mondberg.co.uk" looks great. I'm waiting of OSC MS3. Hopefully extensively CSS orientated.

 

..Harald

Link to comment
Share on other sites

I tried to modify this code piece in ../includes/application_top.php

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

// include the language translations
?require(DIR_WS_LANGUAGES . $language . '.php');
?$current_page = basename($PHP_SELF);
?if (file_exists(DIR_WS_LANGUAGES . $language . '/' . $current_page)) {
? ?include(DIR_WS_LANGUAGES . $language . '/' . $current_page);
?}

But it doesn't effect the search engine it self. The search engine uses still the default language which is set to "english" in the db.

Perhaps I didn't find the the line in application_top.php.

 

 

just before this :

 

// include the language translations

require(DIR_WS_LANGUAGES . $language . '.php');

 

 

you can put something like this on your english site:

 

if ( ($spider_flag) and (!isset($_GET['language'])) ) {

//force language settings for spiders if not specifically requested in the url

$language = 'english';

$languages_id = 1;

}

 

 

and this on your german site :

 

if ( ($spider_flag) and (!isset($_GET['language'])) ) {

//force language settings for spiders if not specifically requested in the url

$language = 'german';

$languages_id = 2;

}

Treasurer MFC

Link to comment
Share on other sites

It works now :) THANK YOU

 

But I had to commend out some lines. Weather the meta-tag checker are dominated by browser language settings, or the string "$spider_flag" isn't recognized by meta-checkers.

I've used this link (free of charge): http://www.widexl.com/remote/search-engine...g-analyzer.html

 

No matter what, it works now, and I am able to run one db, only. The .de domain needs no other languages than german.

 

//if ( ($spider_flag) and (!isset($_GET['language'])) ) {
//force language settings for spiders if not specifically requested in the url
$language = 'german';
$languages_id = 2;
//}

Link to comment
Share on other sites

It works now :)  THANK YOU

 

But I had to commend out some lines. Weather the meta-tag checker are dominated by browser language settings, or the string "$spider_flag" isn't recognized by meta-checkers.

I've used this link (free of charge): http://www.widexl.com/remote/search-engine...g-analyzer.html

 

No matter what, it works now, and I am able to run one db, only. The .de domain needs no other languages than german.

 

//if ( ($spider_flag) and (!isset($_GET['language'])) ) {
//force language settings for spiders if not specifically requested in the url
$language = 'german';
$languages_id = 2;
//}

 

 

$spider_flag is set by your own code in the top of application_top:

 

// start the session

  $session_started = false;

  if (SESSION_FORCE_COOKIE_USE == 'True') {

    tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

 

    if (isset($HTTP_COOKIE_VARS['cookie_test'])) {

      tep_session_start();

      $session_started = true;

    }

  } elseif (SESSION_BLOCK_SPIDERS == 'True') {

    $user_agent = strtolower(getenv('HTTP_USER_AGENT'));

    $spider_flag = false;

 

    if (tep_not_null($user_agent)) {

      $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

 

      for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {

        if (tep_not_null($spiders[$i])) {

          if (is_integer(strpos($user_agent, trim($spiders[$i])))) {

            $spider_flag = true;

            break;

          }

        }

      }

    }

 

    if ($spider_flag == false) {

      tep_session_start();

      $session_started = true;

    }

  } else {

    tep_session_start();

    $session_started = true;

  }

 

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...