Answer the question
In order to leave comments, you need to log in
How to convert one currency?
Good afternoon, please tell me how to solve this problem:
The main currency on the site is rubles, most of the goods are unloaded from 1c to $, then the conversion takes place with this line:
$price = CCurrencyRates::ConvertCurrency($ar_res["PRICE"], "USD", "RUB");
$db_res = CPrice::GetList(
array(),
array("PRODUCT_ID" => $PRODUCT_ID,"CATALOG_GROUP_ID" => $PRICE_TYPE_ID)
);
if ($ar_res = $db_res->Fetch())
{
//print_r($ar_res);
if ($ar_res["PRICE"] == 'RUB' || $ar_res["PRICE"] == 'RUB')
$ar_res["PRICE"] = $price;
else
$price = CCurrencyRates::ConvertCurrency($ar_res["PRICE"], "USD", "RUB");
}
else
$price = 0;
Answer the question
In order to leave comments, you need to log in
Since you're only using currency conversion for output in the template, it's easier to set up the component itself correctly. He knows how to do it by standard means and only where necessary.
the catalog.element and catalog.section components have
"
CONVERT_CURRENCY "
=> "Y"
"CURRENCY_ID" => "RUB" parameters works through a complex directory component. Then these parameters will need to be set in the complex component and ensure that they are passed to catalog.element and catalog.section
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question