[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] "currency convert" oddity or bug?
Hi Robert,
meanwhile I also created a UserTag for this purpose.
Mine currently looks like this:
# Waehrungsumrechnung:
#
# Beispiel:
# [euro][item-price noformat][/euro] Preis in Euro
# [euro currency=de_DE][item-price noformat][/euro] Preis in DM
#
# TO DO: Formatting according to (monetary) locale settings
#
UserTag euro HasEndTag
UserTag euro Interpolate
UserTag euro Order currency
UserTag euro Routine <<EOR
sub {
my ($currency, $amount) = @_;
$currency = "eur_EUR" unless $currency;
$amount *= $Vend::Cfg->{PriceDivide}; # zurückrechnen in
Katalogwährung
$amount /= $Vend::Cfg->{Locale_repository}{$currency}{PriceDivide};
# Formatieren: Waehrungsbezeichnung, Leerzeichen, Betrag
$Vend::Cfg->{Locale_repository}{$currency}{currency_symbol} . " " .
sprintf("%.2f", $amount);
}
EOR
Attention: if you don't at least define the PriceDivide setting for the used
locale(s), this wil result in a division by zero! e.g.:
Locale eur_EUR currency_symbol EUR
Locale eur_EUR PriceDivide 1.95583 (or whatever value for your favourite
currency)
Yours
Klaus