Citát:
Nismo napsal/a:
Tohle v zencartu nelze.
Nismo, jako kdybys nevěděl, že když se ZenCartu pomůže, jde v něm skoro fšecko.
Ale vážně. Ty měny jsou v ZC udělaný opravdu úděsně. Formátování měny je vlastností jazyka (respektive locale), nikoli měny.
Není to sice ideální řešení, ale jde to například takto:
Soubor
/includes/autoloaders/config.language_currencies.php:
<?php
/**
* autoloader array for catalog application_top.php
* see {@link http://www.zen-cart.com/wiki/index.php/Developers_API_Tutorials#InitSystem wikitutorials} for more details.
*
* @package initSystem
* @copyright 2008 Pavel Palek (2P) aka Dedek
* @portions copyright Copyright 2003-2006 Zen Cart Development Team
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: config.language_currencies.php 2008-04-08 2P $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$autoLoadConfig[125][] = array('autoType'=>'init_script', 'loadFile'=> 'init_language_currencies.php');
?>
Soubor
/includes/init_includes/init_language_currencies.php
<?php
/**
* set proper language rules (portions of monetary locale) to $currencies
*
* @package initSystem
* @copyright 2008 Pavel Palek (2P) aka Dedek
* @portions copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: init_language_currencies.php 2008-04-08 2P $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
switch ($_SESSION['language']) {
// British & American English - ¤123,456,789.10
case 'english' :
// CZK
if (is_array($currencies['currencies']['CZK'])) {
$currencies['currencies']['CZK']['title'] = 'Czech Koruna';
$currencies['currencies']['CZK']['symbol_left'] = 'CZK';
$currencies['currencies']['CZK']['symbol_right'] = '';
$currencies['currencies']['CZK']['decimal_point'] = ',';
$currencies['currencies']['CZK']['thousands_point'] = '.';
}
// EUR
if (is_array($currencies['currencies']['EUR'])) {
$currencies['currencies']['EUR']['title'] = 'Euro';
$currencies['currencies']['EUR']['symbol_left'] = 'EUR';
$currencies['currencies']['EUR']['symbol_right'] = '';
$currencies['currencies']['EUR']['decimal_point'] = ',';
$currencies['currencies']['EUR']['thousands_point'] = '.';
}
// SKK
if (is_array($currencies['currencies']['SKK'])) {
$currencies['currencies']['SKK']['title'] = 'Slovak Koruna';
$currencies['currencies']['SKK']['symbol_left'] = 'SKK';
$currencies['currencies']['SKK']['symbol_right'] = '';
$currencies['currencies']['SKK']['decimal_point'] = ',';
$currencies['currencies']['SKK']['thousands_point'] = '.';
}
// USD
if (is_array($currencies['currencies']['USD'])) {
$currencies['currencies']['USD']['title'] = 'American Dollar';
$currencies['currencies']['USD']['symbol_left'] = 'USD';
$currencies['currencies']['USD']['symbol_right'] = '';
$currencies['currencies']['USD']['decimal_point'] = ',';
$currencies['currencies']['USD']['thousands_point'] = '.';
}
break;
// Czech - 123 456 789,10 ¤
case 'czech' :
// CZK
if (is_array($currencies['currencies']['CZK'])) {
$currencies['currencies']['CZK']['title'] = 'Česká koruna';
$currencies['currencies']['CZK']['symbol_left'] = '';
$currencies['currencies']['CZK']['symbol_right'] = ' Kč';
$currencies['currencies']['CZK']['decimal_point'] = ',';
$currencies['currencies']['CZK']['thousands_point'] = ' ';
}
// EUR
if (is_array($currencies['currencies']['EUR'])) {
$currencies['currencies']['EUR']['title'] = 'Euro';
$currencies['currencies']['EUR']['symbol_left'] = '';
$currencies['currencies']['EUR']['symbol_right'] = ' €';
$currencies['currencies']['EUR']['decimal_point'] = ',';
$currencies['currencies']['EUR']['thousands_point'] = ' ';
}
// SKK
if (is_array($currencies['currencies']['SKK'])) {
$currencies['currencies']['SKK']['title'] = 'Slovenská koruna';
$currencies['currencies']['SKK']['symbol_left'] = '';
$currencies['currencies']['SKK']['symbol_right'] = ' Sk';
$currencies['currencies']['SKK']['decimal_point'] = ',';
$currencies['currencies']['SKK']['thousands_point'] = ' ';
}
// USD
if (is_array($currencies['currencies']['USD'])) {
$currencies['currencies']['USD']['title'] = 'Americký dolar';
$currencies['currencies']['USD']['symbol_left'] = '';
$currencies['currencies']['USD']['symbol_right'] = ' $';
$currencies['currencies']['USD']['decimal_point'] = ',';
$currencies['currencies']['USD']['thousands_point'] = ' ';
}
break;
// German - 123.456.789,10 ¤
case 'german' :
// CZK
if (is_array($currencies['currencies']['CZK'])) {
$currencies['currencies']['CZK']['title'] = 'Tschechishe Krone';
$currencies['currencies']['CZK']['symbol_left'] = '';
$currencies['currencies']['CZK']['symbol_right'] = ' CZK';
$currencies['currencies']['CZK']['decimal_point'] = ',';
$currencies['currencies']['CZK']['thousands_point'] = '.';
}
// EUR
if (is_array($currencies['currencies']['EUR'])) {
$currencies['currencies']['EUR']['title'] = 'Euro';
$currencies['currencies']['EUR']['symbol_left'] = '';
$currencies['currencies']['EUR']['symbol_right'] = ' EUR';
$currencies['currencies']['EUR']['decimal_point'] = ',';
$currencies['currencies']['EUR']['thousands_point'] = '.';
}
// SKK
if (is_array($currencies['currencies']['SKK'])) {
$currencies['currencies']['SKK']['title'] = 'Slowakische Krone';
$currencies['currencies']['SKK']['symbol_left'] = '';
$currencies['currencies']['SKK']['symbol_right'] = ' SKK';
$currencies['currencies']['SKK']['decimal_point'] = ',';
$currencies['currencies']['SKK']['thousands_point'] = '.';
}
// USD
if (is_array($currencies['currencies']['USD'])) {
$currencies['currencies']['USD']['title'] = 'Amerikanischer Dollar';
$currencies['currencies']['USD']['symbol_left'] = '';
$currencies['currencies']['USD']['symbol_right'] = ' USD';
$currencies['currencies']['USD']['decimal_point'] = ',';
$currencies['currencies']['USD']['thousands_point'] = '.';
}
break;
}
?>
Stačí upravit druhý soubor podle potřeb e-shopu a oba soubory nakopírovat na server.
Při úpravách doporučuju nahradit mezery před/za symbolem vlevo/vpravo a mezery jako oddělovače tisíců (thousands_point) znakem nezalomitelné mezery. Z klávesnice jde zadat jako ALT+0160 (pod Windows).
PS 1. Měnové konvence (monetary locale) se v různých dokumentech hodně liší. Tyhle jsem převzal z Windows.
PS 2. Nezkoušel jsem to - hledá se dobrovolník k odzkoušení. Ale něco podobnýho mi bez problémů funguje.