I’m creating a simple code that takes exchange rates and multiplies them.
Does anyone know?
At what point do you want to receive this data?
I am modifying the seo template addon placeholder functions.
It seems to be when using placeholder and executing it.
if (empty($object_data['product_id'])) {
return '';
}
$lang_code = !empty($object_data['lang_code']) ? $object_data['lang_code'] : CART_LANGUAGE;
$useless_auth = array();
$currency_code = ($lang_code == 'ko') ? 'KRW' : 'USD';
$price = fn_get_product_price($object_data['product_id'], 1, $useless_auth);
$currencies = Registry::get('currencies');
$currency_symbol = !empty($currencies[$currency_code]['symbol']) ? $currencies[$currency_code]['symbol'] : '';
if ($lang_code == 'ko' && empty($object_data['formatted_price'])) {
$currency_code = 'KRW';
$exchange_rate = 1;
$formatted_price = $price * $exchange_rate;
} elseif ($lang_code == 'en' && empty($object_data['formatted_price'])) {
$currency_code = 'USD';
$exchange_rate = 0.00084;
$formatted_price = $price * $exchange_rate;
}
if ($lang_code =='ko') {
return $formatted_price . $currency_symbol;
} else {
return $currency_symbol . $formatted_price;
}
If I apply the exchange rate manually, it works, but I tried applying several hooks to apply it automatically, but was not successful.
Do you want to use different currencies per language in the store-front?
yes, that’s right.
It would be better if that were possible.
You can make necessary changes in the file which is used to display all prices in the store-front
/design/themes/responsive/templates/common/price.tpl
Thank you Let’s try it.