Hello,
Also trying to get the above. Any solution pls?
Thank you
Printable View
Berserker,
The problem is that Zen Cart doesn't have a built-in sort order capability for currencies like it has for languages. You would have to modify your admin currencies page and the database currencies table in order to implement a sort order.
Here's the steps to do so - please make a backup of your database and affected files first!
1. Add the sort order field to the currencies table - run this query from Admin > Tools > Install SQL Patches:
2. Edit admin/currencies.php so you can enter a sort order:PHP Code:
ALTER TABLE currencies ADD sort_order INT(3) NOT NULL DEFAULT '0';
after this line (line 42):
add this linePHP Code:
$value = zen_db_prepare_input((float)$_POST['value']);
edit the sql query at line 45 so it reads:PHP Code:
$sort_order = zen_db_prepare_input($_POST['sort_order']);
before this line at line 200,PHP Code:
$sql_data_array = array('title' => $title,
'code' => $code,
'symbol_left' => $symbol_left,
'symbol_right' => $symbol_right,
'decimal_point' => $decimal_point,
'thousands_point' => $thousands_point,
'decimal_places' => $decimal_places,
'value' => $value,
'sort_order' => $sort_order);
add this line:PHP Code:
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
Edit the query at line 204 so it reads:PHP Code:
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>
after this line at line 225,PHP Code:
$currency_query_raw = "select currencies_id, title, code, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, last_updated, value, sort_order from " . TABLE_CURRENCIES . " order by sort_order";
add this linePHP Code:
<td class="dataTableContent" align="right"><?php echo number_format($currency->fields['value'], 8); ?></td>
After this line at line 269,PHP Code:
<td class="dataTableContent" align="right"><?php echo $currency->fields['sort_order']; ?></td>
add this linePHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value'));
After this line at line 286PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order'));
add this linePHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value', $cInfo->value));
3. Add the two new language definitions to admin/includes/languages/english/currencies.php (or to a new file in admin/includes/languages/english/extra_definitions/)PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order', $cInfo->sort_order));
4. Edit the file includes/classes/currencies.php (this is a core file - no override capability)PHP Code:
define('TABLE_HEADING_SORT_ORDER', 'Sort Order');
define('TEXT_INFO_CURRENCY_SORT_ORDER', 'Sort Order:');
Modify the query at line 27 to read:
You should be done...now you can add/edit sort orders for the currencies from admin, and they should be displayed in that order in the header.PHP Code:
$currencies_query = "select code, title, symbol_left, symbol_right, decimal_point,
thousands_point, decimal_places, value, sort_order
from " . TABLE_CURRENCIES . " order by sort_order";
Hi,
As per an earlier post, I've modified the currency display into a drop down list by replacing all the codes in tpl_header_currencies with:
$content = "";
$content .= zen_draw_form('currencies_form', zen_href_link(basename(ereg_replace('.php','', $PHP_SELF)), '', $request_type, false), 'get');
$content .= zen_draw_pull_down_menu('currency', $currencies_array, $_SESSION['currency'], 'onchange="this.form.submit();"') . $hidden_get_variables . zen_hide_session_id();
$content .= '</form>';
echo $content;
?>
However the drop down list displays the currency with my left symbol (US$, S$ etc). I'm trying to display the full title of the respective currency instead (US Dollar, Singapore Dollar etc), just like that on http://www.serahsonline.com
Will some kind soul please advise on this? Thanks!
Edit your copy of includes/modules/header_currencies.php
replace this line:
with this:PHP Code:
$currencies_array[] = array('id' => $key, 'text' => (zen_not_null($value['symbol_left']) ? $value['symbol_left'] : $value['symbol_right']) );
PHP Code:
$currencies_array[] = array('id' => $key, 'text' => $value['title']);
Thanks, that worked perfectly!
Hello anyone note that this Language/Currency header disapper on all the Checkout pages?
Hello bunyip I just read your very first post and see that you keep the code to prevernt this header show on all Checkout pages. How if I really want to remove these code? Or at least just show the Language header? It's really necessary for me. Thanks!
To have the language links display on the checkout pages, edit includes/modules/header_languages.php
change this section of code at lines 12-18:to be just:PHP Code:
// test if box should display
$show_currencies= false;
// don't display on checkout page:
if (substr($current_page, 0, 8) != 'checkout') {
$show_currencies= true;
}
Make exactly the same edit to the file includes/modules/header_currencies.php if you want the currency links to display on checkout pages.PHP Code:
// test if box should display
$show_currencies= true;
Thank so much for the reply. :smile:
A download a: Contribution: Language/Currency Links in Header
Hay to install?
Whare to put code into tpl_header.php?
<!-- bof languages/currencies header display -->
<div id="navCurrenciesWrapper" class="forward">
<?php
if (HEADER_LANGUAGES_DISPLAY == 'True') require(DIR_WS_MODULES . 'header_languages.php');
if (HEADER_CURRENCIES_DISPLAY == 'True') require(DIR_WS_MODULES . 'header_currencies.php');
?>
</div>
<!-- eof languages/currencies header display -->
I trie to put code on end in file end nothing happen.
Whare to put new classes to my stylesheet so I can control the format of the currency links?
#navCurrenciesWrapper a {
color: #ffffff;
text-decoration: none;
}
#navCurrenciesWrapper a:hover {
color: #000000;
text-decoration: none;
}