简体   繁体   English

当小数货币设置为4时,如何在CS-CART上用逗号后显示两位数?

[英]How to show 2 digits after comma on CS-CART when decimals in currency set to 4?

For accurate VAT counting our e-shop set currency to show 4 digits after comma. 为了准确计算增值税,我们的网上商店将币种设置为逗号后显示4位数字。 How to show only 2 digits on store, but keep counting VAT when 4 digits set after comma in admin panel. 如何在商店中仅显示2位数字,但是在管理面板中的逗号后设置4位数字时继续计算增值税。 Now it shows something like this: €23.1621 , need to be €23.16 现在显示如下:€23.1621,需要为€23.16

Thank You in advance 先感谢您

您是否尝试过round()函数?

echo round(price, 2);

It depends on the version. 这取决于版本。

In 4.1.x version you can try to modify the "smarty_modifier_format_price" function ( app/functions/smarty_plugins/modifier.format_price.php ) 在4.1.x版本中,您可以尝试修改“ smarty_modifier_format_price”功能( app / functions / smarty_plugins / modifier.format_price.php

Change this 改变这个

$value = fn_format_rate_value($price, $number_type, $currency['decimals'], $currency['decimals_separator'], $currency['thousands_separator'], $currency['coefficient']);

By this 这样

$value = fn_format_rate_value($price, $number_type, 2, $currency['decimals_separator'], $currency['thousands_separator'], $currency['coefficient']);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM