News:

Looking for documentation? Take a look on our wiki

Main Menu

Change currency per language?

Started by drizzt99, August 08, 2012, 21:06:41 PM

Previous topic - Next topic

Ihateit

Has anyone got a solution for this??? I think it's an pretty important feature. Someone must have made it work

(i want to change currency, when language is changed)

//Anders J.


Ihateit

That worked like a charm. Thank you very much. Where do i find the virtuemart_currency_id list? I dont know what IDs Danish Kroner, Swedish Kroner, Norweigan Kroner and Euro has.

To clarify what i did to make this work, to future troubleshooters:

I pasted the code under this line, after the line 37: $virtuemart_currency_id = $mainframe->getUserStateFromRequest( "virtuemart_currency_id", 'virtuemart_currency_id',JRequest::getInt('virtuemart_currency_id', $vendor_currency['vendor_currency']) );   ----- in the \modules\mod_virtuemart_currencies\mod_virtuemart_currencies.php file.
$jlang =JFactory::getLanguage();
$lang = $jlang->getTag();
if ($lang == "da-DK")
    {$virtuemart_currency_id = 208;}
    elseif ($lang == "se-SV")
    {$virtuemart_currency_id = 752;}
elseif ($lang == "no-NO")
    {$virtuemart_currency_id = 578;}
else
    {$virtuemart_currency_id = 978;}

The Currency IDs are random though..

SamF

There is no "list", I think. Not in VM backend. Browse your database table jos_virtuemart_currencies for virtuemart_currency_id.

Ihateit

Again thanks a lot. That really helped out. Everything is working perfectly now. Except i can't remove the decimals from my prices(even when disabling it in administration). But that is different topic :-P

Honza


atrus

Hi to all,

This feature is also implemented in Artio's Joomsef for anyone interested. (We had asked this to the developers)

Rgrds,
Chris

Sent from my BlackBerry 9360 using Tapatalk

nhinzky

Quote from: drizzt99 on August 20, 2012, 12:48:00 PM
Ok,
I think it's done right now, but it's changing core files, which is bad for biz.
Add this code:

$lang =& JFactory::getLanguage();
   
        if ($lang->get('tag') == "he-IL" ) {
             $currencyId  = 67;
              }
           else {
             $currencyId  = 144;
            }


In 2 places in the file (/administrator/components/com_virtuemart/helpers/currencydisplay.php):
1) Right after public function getCurrencyForDisplay( $currencyId=0 ){
2) Right after self::$_instance = new CurrencyDisplay($vendorId);

Just don't forget to change he-IL to french and the 67 to the french number.

Worked for me...
Thanks! works for me  :D

davidator

#38
hello
do you think its possible, with your code,  to change currencie for a specific category ?
I mean,  category number  instead of a language   

Products of Category1 (11111)=> $             other Category Products=>€


   
        if ($cat==11111 ) {
             $currencyId  = 67;
              }
           else {
             $currencyId  = 144;
            }

Thank You