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:
PHP Code:
ALTER TABLE currencies ADD sort_order INT(3) NOT NULL DEFAULT '0';
2. Edit admin/currencies.php so you can enter a sort order:
after this line (line 42):
PHP Code:
$value = zen_db_prepare_input((float)$_POST['value']);
add this line
PHP Code:
$sort_order = zen_db_prepare_input($_POST['sort_order']);
edit the sql query at line 45 so it reads:
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);
before this line at line 200,
PHP Code:
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
add this line:
PHP Code:
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_SORT_ORDER; ?></td>
Edit the query at line 204 so it reads:
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";
after this line at line 225,
PHP Code:
<td class="dataTableContent" align="right"><?php echo number_format($currency->fields['value'], 8); ?></td>
add this line
PHP Code:
<td class="dataTableContent" align="right"><?php echo $currency->fields['sort_order']; ?></td>
After this line at line 269,
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value'));
add this line
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order'));
After this line at line 286
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_VALUE . '<br>' . zen_draw_input_field('value', $cInfo->value));
add this line
PHP Code:
$contents[] = array('text' => '<br>' . TEXT_INFO_CURRENCY_SORT_ORDER . '<br>' . zen_draw_input_field('sort_order', $cInfo->sort_order));
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:
define('TABLE_HEADING_SORT_ORDER', 'Sort Order');
define('TEXT_INFO_CURRENCY_SORT_ORDER', 'Sort Order:');
4. Edit the file includes/classes/currencies.php (this is a core file - no override capability)
Modify the query at line 27 to read:
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";
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.
Bookmarks