Ticket amounts above thousand stored wrong in db

WordPress Event Management, Calendars & Registration Forums Report A Bug Ticket amounts above thousand stored wrong in db

This topic contains 1 reply, has 2 voices, and was last updated by  Stephen Harris 11 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #5740

    Hi

    The issue is fairly simple but it took me a while to find out and fix.

    When somebody creates ticket that has amount above 999 it is stored in database as “1,000.00” because of “number_format” function that is setting up the price for DB in “event-organiser-pro/includes/tickets.php” both “eventorganiser_insert_ticket” and “eventorganiser_update_ticket” methods.

    It looks correct when in database, but after displaying it in view while booking tickets it is truncated by javascript to display pretty prices so ticket amount comes out as a “1.00”.

    I assume that price cant be stored with just (which gives us “1, 000.00”)

    number_format( $ticket['price'], 2)

    It has to be done with english format (which gives us “1000.00”)

    number_format( $ticket['price'], 2, '.', '' )

    So when it is taken from input to display, javascript wont truncate the value.

    What do you think?

    Mozin

    Mozin Podlis
    #5743

    Expensive tickets 🙂

    Thanks for your work on this Mozin. I’m not quite sure why number_format() is being used there – its really only for output – so I’ve removed those two instances from 1.0.3 which I’m about to release. This fixes the issue.

    Thanks again!
    Stephen

    Stephen Harris
Viewing 2 posts - 1 through 2 (of 2 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.