Documentation

BX.Currency.currencyFormat

BX.Currency.currencyFormat(
price, currency, useTemplate
);

The function formats price.

Function parameters

Parameter Description Type
price Price amount. string, int, float
currency Currency ID. string
useTemplate Use/do not use template. Available values:
  • false – display only price amount;
  • true – display full formatted price.
bool

Returned value

String.

Examples:

<? 
CJSCore::Init(array('currency')); 
 
$currencyFormat = CCurrencyLang::GetFormatDescription('USD'); 
?> 
<script type="text/javascript"> 
BX.Currency.setCurrencyFormat('RUB', <? echo CUtil::PhpToJSObject($currencyFormat, false, true); ?>);  
var formatRub = BX.Currency.currencyFormat(121.50, 'USD', true);  
alert(formatRub); 
</script>



© «Bitrix24», 2001-2024