Gowans007 Posted May 19, 2010 Posted May 19, 2010 I have added the currencies to the admin section however there is no option to choose them for the user. Is there ment to be an option or a include to turn this on? if so how/what do I do?
Collines Posted May 20, 2010 Posted May 20, 2010 Usually, the currency box shows in the right column. If you have removed the right column, then you will need to use a contribution to add the currencies to the header. You can add this line wherever you want the currency bar to appear in the header: <?php if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { include(DIR_WS_BOXES . 'currencies.php'); } ?> The first line of the above code ensures that the currency bar is not shown during the checkout procedure as this can cause some problems. If you want to include the currency bar in the checkout procedure then simply add the line like this: <?php include(DIR_WS_BOXES . 'currencies.php'); ?> Obviously, both of the above code snippets will take the currency code from includes/boxes/currencies.php which will have the formatting of the regular boxes, so you will need to edit that to remove the header and box formating. Leaving your file includes/boxes/currencies.php looking something like this: <?php if (isset($currencies) && is_object($currencies)) { $info_box_contents = array(); 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); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onchange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); new headBox($info_box_contents); } ?>
Collines Posted May 20, 2010 Posted May 20, 2010 If anyone is interested, the language bar can also be added to the header by adding this line wherever it is needed. <?php require(DIR_WS_BOXES . 'languages.php'); ?> Then you will need to edit includes/boxes/languages.php to strip out the code that adds the box heading and formatting so the file looks something like this. <?php $info_box_contents = array(); 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(); $info_box_contents[] = array('align' => 'center', 'text' => $languages_string); new infoBox($info_box_contents); ?>
Collines Posted May 20, 2010 Posted May 20, 2010 And finally..... Adding text links to My Account (or logoff if logged in), checkout and a shopping basket that shows how many items in the cart and the value of the cart, just add this wherever it is needed. <?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo TEXT_MY_BASKET . ': ' . $cart->count_contents() . ($cart->count_contents() == "1" ? " article " : " articles "); ?> <?php echo $currencies->format($cart-> show_total()); ?> </a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> The above code can easily be manipulated to added an image of a shopping cart or to make it appear over three lines or whatever.
eleazar Posted June 17, 2010 Posted June 17, 2010 Usually, the currency box shows in the right column. If you have removed the right column, then you will need to use a contribution to add the currencies to the header. You can add this line wherever you want the currency bar to appear in the header: <?php if (substr(basename($PHP_SELF), 0, 8) != 'checkout') { include(DIR_WS_BOXES . 'currencies.php'); } ?> The first line of the above code ensures that the currency bar is not shown during the checkout procedure as this can cause some problems. If you want to include the currency bar in the checkout procedure then simply add the line like this: <?php include(DIR_WS_BOXES . 'currencies.php'); ?> Obviously, both of the above code snippets will take the currency code from includes/boxes/currencies.php which will have the formatting of the regular boxes, so you will need to edit that to remove the header and box formating. Leaving your file includes/boxes/currencies.php looking something like this: <?php if (isset($currencies) && is_object($currencies)) { $info_box_contents = array(); 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); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onchange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); new headBox($info_box_contents); } ?> I did this but I got the following error. Fatal error: Class 'headBox' not found in /home/starme/public_html/includes/boxes/currencies.php on line 37 I just wanted to put the currency in the header. Thanks in advance!
l3akuuu Posted September 23, 2010 Posted September 23, 2010 I did this but I got the following error. Fatal error: Class 'headBox' not found in /home/starme/public_html/includes/boxes/currencies.php on line 37 I just wanted to put the currency in the header. Thanks in advance! Hi I got the same error. And to fix this is just to change the last-line code of includes/boxes/currencies.php to <?php if (isset($currencies) && is_object($currencies)) { $info_box_contents = array(); 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); } } $info_box_contents = array(); $info_box_contents[] = array('form' => tep_draw_form('currencies', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get'), 'align' => 'center', 'text' => tep_draw_pull_down_menu('currency', $currencies_array, $currency, 'onchange="this.form.submit();" style="width: 100%"') . $hidden_get_variables . tep_hide_session_id()); new infoBox($info_box_contents); } ?> I think you may have fixed this bug already. But this will be useful for others who come to this topic. :)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.