Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

changing the default currency infobox


toptiara

Recommended Posts

Posted

OK, so I changed my site layout to have the search box, language box and currency infobox details directly below my graphic in my header. I've managed to get the search and language infoboxes to display correctly by modifying them to pull their data from new header files (search_header.php and language_header.php respectively) and updating the code within accordingly.

 

search_header.pho has :

 

<?php

echo tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', 'NONSSL', false), 'get');

echo tep_draw_input_field('keywords', BOX_HEADING_SEARCH, 'size="10" maxlength="30" style="width: ' . (BOX_WIDTH-30) . 'px"') . ' ' . tep_hide_session_id() . tep_image_submit('button_quick_find.gif', BOX_HEADING_SEARCH);

echo '</form>';

?>

 

 

language_header has :

 

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

}

 

$info_box_contents = array();

echo $languages_string;

?>

 

Both of these files work fine.

 

However, I can't for the life of me get my head around the currency_header.php. I have pulled the relevant code from the currencies.php file and reworked it to what I thought should work...

 

<?php

if (isset($currencies) && is_object($currencies)) {

?>

<!-- currencies //-->

 

<?php

echo '<strong>' . BOX_HEADING_CURRENCIES . '</strong>';

 

reset($currencies->currencies);

$currencies_array = array();

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

$currencies_array[] = array('id' => $key, 'text' => $value['title']);

}

 

$hidden_get_variables = '';

reset($HTTP_GET_VARS);

while (list($key, $value) = each($HTTP_GET_VARS)) {

if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {

$hidden_get_variables .= tep_draw_hidden_field($key, $value);

}

}

 

echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id());

echo '</form>';

?>

<!-- currencies_eof //-->

<?php

}

?>

 

Ideally this should be putting the currency details into a single row on a table cell, showing 'Currency' in bold with a drop down box nect to it allowing you to select the currency you want. I'm getting an error though :(

 

Parse error: syntax error, unexpected ')', expecting ',' or ';' in C:\Program Files\xampp\htdocs\www\catalog\includes\boxes\header_currency.php on line 24

 

Warning: Unknown: open(/tmp\sess_f6790a42d4f18dddda50186ca53a9cee, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

 

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

 

Line 24 is :

echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

 

 

 

Does anyone have a snippet of code for a single row with the detail I'm after by any chance please? Or if not, can anyone help me debug this by any chance? It's late here and I'm at the end of my tether!

 

Thanks

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Posted

Hmm can't seem to edit my previous post sadly so I'll have to use reply...

 

After hunting aroudn a bit, I found something I can use, but it doesn't allow me to put all the information in a single row... It shows 'Currencies' on one row, then the drop down list is displayed below it. I'd like them side by side so they are on a single row, but I can't get it to work :(

 

This is my new code :

 

<? // CURRENCIES

echo '<strong>' . BOX_HEADING_CURRENCIES . '</strong>';

echo tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get');

 

reset($currencies->currencies);

$currencies_array = array();

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

$currencies_array[] = array('id' => $key, 'text' => $value['title']);

}

 

$hidden_get_variables = '';

reset($HTTP_GET_VARS);

while (list($key, $value) = each($HTTP_GET_VARS)) {

if ( ($key != 'currency') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {

$hidden_get_variables .= tep_draw_hidden_field($key, $value);

}

}

 

echo tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onChange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id();

echo '</form>';

 

?>

 

Help as always is greatfully received.

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Posted

My site is here if you want to look :)

 

Thanks

Hand made jewellery and tiaras on our website

 

Please bear with me. Im an osC noobie!

Archived

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

×
×
  • Create New...