Download & Extend

Be more forgiving of user-entered price formats

Project:UC Variable Price
Version:6.x-1.0-rc3
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

Varprice accepts user-entered data for a product price. There is a problem though: there are many ways that people format currency in different parts of the world. For example, comma vs period as the decimal delimiter, and comma or period as thousands separator. Also users might easily add a currency symbol.

This patch makes the module as forgiving as possible to user-entered price data. It strips all non-numeric characters from the entered price except comma and period, then converts it to a plain decimal number regardless of the number format it was entered in.

AttachmentSize
varprice_currency_acceptance.patch922 bytes

Comments

#1

Status:needs review» reviewed & tested by the community

I can't guarantee that I found all of the possible combinations of commas and periods that are legitimate styles somewhere in the world, but this works as expected.

nobody click here