Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Did anybody manage to get the languages out of the box???


webby70

Recommended Posts

Posted

Hello

 

Fighting with an issue which has been posted in different forms till now (see the shopping card topic) but is not very clear to me yet ... :(

 

I need to get the language flags out of the box-style, and would prefer not to have to define an other class (I don't know exactely from where to where should I duplicate that code anyways ).

 

Just need the pure code for the language flags !!!

 

I have managed to work it out for the information box for ex, but with the languages looks more complicated ...

 

Anybody can help?

 

Many thanks

  • 2 weeks later...
Posted

Hi,

 

I had the same problem

 

for www.computerware.ch

 

What I did is to put the flags images where I want, and asign a link to the images.

 

Best regards

Posted

Create a new php file in 'catalog/includes' named 'my_languages_header.php' or whatever name.

 

Then paste into the file the following content:

 

<?php

/*

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2001 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- languages //-->

<?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;

?>

<!-- languages_eof //-->

 

 

This version displays on one line the different languages separated by ' | '. I instead you want to display the languages images then comment out the first $languages_string = ... and put comment around the second line $languages_string = ...

 

 

Then, anywhere you want the 'languages string' to be display you just need to add:

 

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

include(DIR_WS_INCLUDES . 'my_languages_header.php');

}

?>

 

that's it!

 

Jeff

Posted

Hi,

 

Thank for the post. I tried your solution.

 

But I have this error

Warning: Failed opening 'includes/classes/language.php' for inclusion (include_path='.:/usr/local/lib/php/') in /home/computerware.ch/www/catalog/includes/my_languages_header.php on line 14

 

Fatal error: Cannot instantiate non-existent class: language in /home/computerware.ch/www/catalog/includes/my_languages_header.php on line 15

Posted

First: did the 'standard' OSC languages box work on your system? If yes then, at the beginning of catalog/includes/boxes/languages.php you should have the same code than the one in my file 'my_languages_header.php' which is:

if (!is_object($lng)) {

include(DIR_WS_CLASSES . 'language.php');

$lng = new language;

}

 

This code just 'tell': go to the directory DIR_WS_CLASSES and include the file languages.php. So, if this doesn't work then you should check:

- the value of DIR_WS_CLASSES: usually defined in includes/configure.php with the following value: define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

 

- if the file languages.php is present in the folder catalog/includes/classes.php

 

I hope this help,

 

Jeff

Archived

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

×
×
  • Create New...