Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Dynamic Language Image Selection


insomniac2

Recommended Posts

I am trying to configure the language selection to use images much like one of the currency image selection mods.

 

I have basically duplicated the currencies mod instructions to the language selection.

 

The currencies images work perfect. Only the selected currencies flag is not greyed out or faded and the selected currencies image is in full color.

 

Now when I try it with the language selection I get all the images greyed out ... when the selected currencies image should use the alternate full color image.

 

Here is the code ... I have tried everything and must have missed something simple.

 

 

<?php

//<!--// BEGIN ADDED CURRENCY SELECTION //-->

 

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

 

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

include(DIR_WS_CLASSES . 'language.php');

$lng = new language;

}

 

reset($lng->catalog_languages);

$lng_array = array();

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

$lng_array[] = array('id' => $key,

'text' => $value['name']);

}

 

$languages_string = '';

reset($lng->catalog_languages);

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

 

if ($lng == $key) {

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

} else {

$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_off'], $value['name']) . '</a> ';

}

}

 

echo 'Languages:' . $languages_string;

}

?>

<!--// END ADDED CURRENCY SELECTION //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...