Results 1 to 5 of 5

Thread: Comma in the price field

  1. #1
    Thread Starter
    Veteran sarge's Avatar
    Join Date
    Jun 2009
    Location
    USA
    Posts
    628
    Thanks
    2
    Thanked 9 Times in 9 Posts

    Unhappy Comma in the price field

    Hi,

    I am having trouble with the price calculating.

    If a person enters a comma along with their price, the final percentage of the sale is not calculated correctly.

    Instead of the person being charged $1700, they are charged $700. Even though there is a fine print that says enter numerical values only.

    Is there a quick fix or mod for this small but big problem?
    Always treat everyone with respect and courtesy, but trust no one.

  2. #2
    Junior Member EbayClass's Avatar
    Join Date
    May 2010
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comma in the price field

    You can do a filter with regex.

    Code:
    if (! eregi("^[a-zA-Z0-9]*$", $_POST["myinput"]) ) {echo "This field only allows letters & numbers.";}
    Allen

  3. #3
    Thread Starter
    Veteran sarge's Avatar
    Join Date
    Jun 2009
    Location
    USA
    Posts
    628
    Thanks
    2
    Thanked 9 Times in 9 Posts

    Re: Comma in the price field

    Thanks Allen.

    Where exactly does that code go? Which file?
    Always treat everyone with respect and courtesy, but trust no one.

  4. #4
    Junior Member EbayClass's Avatar
    Join Date
    May 2010
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Comma in the price field

    I'm using 2.9.3,

    However you can do 1 of 2 things.

    1. put it in the form_process.php (you'll see similar lines) and just change myinput to PRICE
    and remove the echo statement, it'll just sanitize the input.

    if (! eregi("^[a-zA-Z0-9]*$", $_POST["myinput"]) ) {echo "This field only allows letters & numbers.";}

    or

    2. Put it in the post_form.php and give them that message.
    <?php if (! eregi("^[a-zA-Z0-9]*$", $_POST["myinput"]) ) {echo "This field only allows letters & numbers.";} ?>

    Hope that helps.
    Allen

  5. #5
    Thread Starter
    Veteran sarge's Avatar
    Join Date
    Jun 2009
    Location
    USA
    Posts
    628
    Thanks
    2
    Thanked 9 Times in 9 Posts

    Re: Comma in the price field

    I couldn't get any of these to work
    Always treat everyone with respect and courtesy, but trust no one.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Is it possible to price by groups?
    By ThemeSwitcher in forum ClassiPress General Discussion
    Replies: 1
    Last Post: July 18th, 2009, 09:31 AM