Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Language box: hiding active


mazza

Recommended Posts

Posted

How could the selected language be hidden ?

 

For example, if the language was english, there would be only spanish and german flags and if spanish would be selected only german and english flags would be visible.

"Use no way as way, have no limitation as limitation." - Bruce Lee

Posted

Anybody ?

 

I tried modifying the sql statement in includes/classes/language.php but it did not.

 

Apparently the only place this could be done is includes/boxes/language.php by modifying this code:

 

 

 

  $languages_string = '';

 reset($lng->catalog_languages);

 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, $connection) . '">' . tep_image(DIR_WS_LANGUAGES .  $value['directory'] . '/images/' . $value['image'], $value['name']) . '</a> ';

 }

 

But how ?

"Use no way as way, have no limitation as limitation." - Bruce Lee

Posted

Like this:

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

   if (!strcasecmp($value['name'], $language)) continue;

   $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> ';

 }

Christian Lescuyer

Posted

Thank you Christian, again. :D

"Use no way as way, have no limitation as limitation." - Bruce Lee

  • 3 years later...
Posted

I have the following code:

 

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

$languages_string = '';
reset($lng->catalog_languages);
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> ';
}

echo $languages_string;
?>

 

How do I modify it to make the above happen. I too only want to show the flag for the language that is not being used.

 

Thanks!

Posted
I have the following code:

 

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

$languages_string = '';
reset($lng->catalog_languages);
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> ';
}

echo $languages_string;
?>

 

How do I modify it to make the above happen. I too only want to show the flag for the language that is not being used.

 

Thanks!

 

<?php

if (!isset($lng) || (isset($lng) && !is_object($lng))) {

include(DIR_WS_CLASSES . 'language.php');

$lng = new language;

}

if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {

reset($lng->catalog_languages);

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

if ($language != $value['directory'] ){

$languages_string .= ' | <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency', 'action')) . 'lng=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name'],'','',' style="vertical-align: middle;" ') . '</a>';

}

}

echo $languages_string;

}

?>

Treasurer MFC

Posted

That worked almost perfectly. It had an error where the code should have read:

 

'language=' . $key, $request_type)

 

instead of

 

'lng=' . $key, $request_type)

 

as suggested. But I figured that out on my own and now it works perfectly.

 

Thank you very much, boxtel.

 

-zp

Posted

One more thing.

 

Where's that pesky vertical dash "|" that appears between the flags called in the above code?

 

Now that I have only one flag I don't need it and want to remove it.

 

Thanks!

Archived

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

×
×
  • Create New...