outlet.ee Posted March 20, 2010 Share Posted March 20, 2010 The currency in Estonia is 'kr', short for 'kroon'. However, in Russian the short is 'кр' but there is no option for translating the currency symbol. I was wondering whether there is another way of modifying it? Link to comment Share on other sites More sharing options...
rocky Posted March 20, 2010 Share Posted March 20, 2010 Topic movedI suggest modifying classes/Tools.php and adding the following in the displayPrice function after the $c_char = line: if ($c_char == 'kr' AND $cookie->id_lang == 8) $c_char = 'кр'; Change 8 to the id of the Russian language on your website.You may need to add the following at the start of the function to allow access to the cookie: global $cookie; Link to comment Share on other sites More sharing options...
outlet.ee Posted March 20, 2010 Author Share Posted March 20, 2010 Thank you for the prompt reply.when I inserted the cookie, I received an error 'cannot link to the database'. Where exactly should I insert the cookie?Also it says 'if you modified this function, don't forget to modify the Javascript function formatCurrency (in tools.js) if ($convert)*/, what sould I modify in there? static public function displayPrice($price, $currency, $no_utf8 = false, $convert = true) { /* if you modified this function, don't forget to modify the Javascript function formatCurrency (in tools.js) */ if ($convert) $price = self::convertPrice($price, $currency); if (is_int($currency)) $currency = new Currency(intval($currency)); $c_char = (is_array($currency) ? $currency['sign'] : $currency->sign); if ($c_char == 'kr' AND $cookie->id_lang == 4) $c_char = 'кр'; $c_format = (is_array($currency) ? $currency['format'] : $currency->format); $c_decimals = (is_array($currency) ? intval($currency['decimals']) : intval($currency->decimals)) * _PS_PRICE_DISPLAY_PRECISION_; $c_blank = (is_array($currency) ? $currency['blank'] : $currency->blank); $blank = ($c_blank ? ' ' : ''); $ret = 0; if (($isNegative = ($price < 0))) $price *= -1; switch ($c_format) { /* X 0,000.00 */ case 1: $ret = $c_char.$blank.number_format($price, $c_decimals, '.', ','); break; /* 0 000,00 X*/ case 2: $ret = number_format($price, $c_decimals, ',', ' ').$blank.$c_char; break; /* X 0.000,00 */ case 3: $ret = $c_char.$blank.number_format($price, $c_decimals, ',', '.'); break; /* 0,000.00 X */ case 4: $ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char; break; } if ($isNegative) $ret = '-'.$ret; if ($no_utf8) return str_replace('€', chr(128), $ret); return $ret; } Link to comment Share on other sites More sharing options...
rocky Posted March 20, 2010 Share Posted March 20, 2010 It should be the first line of the function like this: static public function displayPrice($price, $currency, $no_utf8 = false, $convert = true) { /* if you modified this function, don't forget to modify the Javascript function formatCurrency (in tools.js) */ global $cookie; if ($convert) $price = self::convertPrice($price, $currency); if (is_int($currency)) $currency = new Currency(intval($currency)); $c_char = (is_array($currency) ? $currency['sign'] : $currency->sign); if ($c_char == 'kr' AND $cookie->id_lang == 4) $c_char = 'кр'; $c_format = (is_array($currency) ? $currency['format'] : $currency->format); $c_decimals = (is_array($currency) ? intval($currency['decimals']) : intval($currency->decimals)) * _PS_PRICE_DISPLAY_PRECISION_; $c_blank = (is_array($currency) ? $currency['blank'] : $currency->blank); $blank = ($c_blank ? ' ' : ''); $ret = 0; if (($isNegative = ($price < 0))) $price *= -1; switch ($c_format) { /* X 0,000.00 */ case 1: $ret = $c_char.$blank.number_format($price, $c_decimals, '.', ','); break; /* 0 000,00 X*/ case 2: $ret = number_format($price, $c_decimals, ',', ' ').$blank.$c_char; break; /* X 0.000,00 */ case 3: $ret = $c_char.$blank.number_format($price, $c_decimals, ',', '.'); break; /* 0,000.00 X */ case 4: $ret = number_format($price, $c_decimals, '.', ',').$blank.$c_char; break; } if ($isNegative) $ret = '-'.$ret; if ($no_utf8) return str_replace('€', chr(128), $ret); return $ret; } Link to comment Share on other sites More sharing options...
outlet.ee Posted March 20, 2010 Author Share Posted March 20, 2010 Thanks, it is working now but there is encoding issue, it gives ?? instead of кр. Link to comment Share on other sites More sharing options...
outlet.ee Posted March 20, 2010 Author Share Posted March 20, 2010 Solved, I had to encode utf w/o BOM when editing in Notepad ++.Thank you very much, Rocky! Link to comment Share on other sites More sharing options...
outlet.ee Posted August 26, 2010 Author Share Posted August 26, 2010 Rocky,I noticed it works with older products but not with the products added recently, however, there is no exact pattern on which it works. Do you have an idea why is that? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now