Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Language switch


m-xn

Recommended Posts

Posted

Hi folks,

 

I don't know much about php, sorry, but I have the following problem:

 

I have two languages, English and German, installed in my osC installation. The language links are now in the header, described here: http://www.oscommerce.com/forums/index.php?s=&...indpost&p=67701

 

No problem for now.

 

But I only want the button be present for the language which is not active. Understand? When the shop is displayed in German, I want the "English" link only, if the shop is displayed in English I want the "German" Link/Button to be present only. Not the button for the language which is actually active, since this is useless in my opinion.

 

It's the same as described in the above link but only displayed the language(s) which is not active.

 

Has anyone an idea?

 

Thank you very much for your help.

 

m-xn

Posted

Well, I see that this code displays "each" language it finds installed on this osC installation:

 

<?php
if (!is_object($lng)) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}

if (getenv('HTTPS') == 'on') $connection = 'SSL';
else $connection = 'NONSSL';

$languages_string = '';
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
// Just images:
/*
$languages_string .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $connection) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a>  
';
*/
// Just Languages name:
$languages_string .= '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $connection) . '" class="linkColor5">' . $value['name'] . '</a> |
';
}

echo $languages_string;
?>

 

But I want, that it only displays the "next" (the *other*) language, which is not active yet, not both languages.

 

I hope there is someone out there who speaks php and point me to it. I guess the trick is here, right?

 

while (list($key, $value) = each($lng->catalog_languages)) {

 

Thanks. Danny

  • 2 years later...
Posted

I've got the same problem. I need to show only inactive language flags!

Have you resolved it?

Thanks a lot for all our community members. It's amazing that we are together and we have opportunity to help each oher.

Posted
I've got the same problem. I need to show only inactive language flags!

Have you resolved it?

 

 

Hi

 

To fix in catalog/includes/boxes/languages.php

 

after :

 

while (list($key, $value) = each($lng->catalog_languages)) {

 

add:

 

if ((int)$languages_id == $value['id']) continue;

 

 

;)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted
Hi

 

To fix in catalog/includes/boxes/languages.php

 

after :

 

while (list($key, $value) = each($lng->catalog_languages)) {

 

add:

 

if ((int)$languages_id == $value['id']) continue;

 

 

;)

 

wow! it works! thanks Sam :)

"I am not a Newbie but I am not an Expert either..."
"Lets learn about osCommerce together!..."

Archived

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

×
×
  • Create New...