简体   繁体   中英

SimpleCart not allowing thousand comma separator

I am using simplecart. Nice and simple, I have dealt with most of its flaws but this one is bothering me still.

a price is presented with , as a thousand separator, pretty standard stuff!

EG: $2,456.55

once its added to the cart its added as only 2 This must be the comma.

I think I have found the offending line:

_data.price = parseFloat(_data.price.replace(simpleCart.currency().decimal, ".").replace(/[^0-9\.]+/ig, ""));

What should I add to remove any found comma to the REGEX?

只删除,这比较简单

replace(/,/, "")

issue not in simplecart. Its in a presentation script in PHP using floatval without first removing the commas.....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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