Support

Home Forums Event Espresso Premium EE4: Thousands separator in ticket price

EE4: Thousands separator in ticket price

Posted: December 8, 2014 at 4:39 pm

Viewing 24 reply threads


IFMA Toronto

December 8, 2014 at 4:39 pm

We have an event that has a ticket cost of $2325.00 when we enter this into the ticket price field, and click update the price is shown with the thousand separator (,) to be $2,325.00 when we view the event it displays the ticket price as $2.00.

Also, if we change any other settings on the event the price for the ticket (on the admin screen) updates to $2.00 as well.

It appears the comma is the issue, as if I enter a ticket price of $23,000.00 (directly inputting the comma) the refreshed page shows a price of $23.00


Sidney Harrell

December 8, 2014 at 5:31 pm

The fix for the issue is in the 4.5 release, which is available in the pre-release channel on your account page. Our apologies for the inconvenience.


IFMA Toronto

December 9, 2014 at 1:01 am

When is 4.5 expected to be released? If it is not soon, is it possible to get a code snippet as a patch?

We have an event with tickets that were set to go on sale on Dec. 10th.


Lorenzo Orlando Caum

  • Support Staff

December 9, 2014 at 7:06 am

We have a few tickets remaining and then we’ll go through a testing checklist. Entering the pricing without the comma should hold the pricing option.


Lorenzo


Dean

December 9, 2014 at 7:18 am

Hi,

Unfortunately we probably won’t have it formally released by that point, but it is available in the Pre Release channel as a download. It is important to note that the Pre Release version is a BETA and as such may have unexpected bugs. We don’t really recommend it for live sites.

Pre Release channel info: https://eventespresso.com/wiki/pre-release-channel-guide/


IFMA Toronto

December 9, 2014 at 8:43 am

Without inputting the comma seems to save the value, however viewing the frontend page displays the incorrect formatted price again. (ie: $2.00 instead of $2225).

I need a fix before tickets go on sale tomorrow, and the pre-release channel isn’t an option for our live site. Is there any way to get a code snippet to fix? If not I’ll have to find one out myself.


jpacooper

December 9, 2014 at 8:49 am

Hi, I am also experiencing the same issue. Tickets at $1000 are displaying as $1.00

This basically renders your system unusable. I need to fix this ASAP. I also have tickets going on sale in 2 days from now. What can I do?


Della Baines

December 9, 2014 at 9:00 am

I’m also having this problem. Could you point me to the area of the code to create a fix temporarily until the new version is released?


Josh

  • Support Staff

December 9, 2014 at 12:17 pm

Hi everyone,

Please update to 4.4.6.p, which is available now. It has the fix for the thousands separator issue.


IFMA Toronto

December 9, 2014 at 1:22 pm

I have updated to 4.4.6 and the issue is only half fixed.

The price value now saves correctly on the admin side, however the ticket selector still shows the price as the $2.00 / $3.00.

The correct price does show on the registration page however.


Josh

  • Support Staff

December 9, 2014 at 1:35 pm

Hi Scott,

Can you let me know what you are entering for the prices?


IFMA Toronto

December 9, 2014 at 1:36 pm

$2925 and $3225 (both have VAT tax as well).


Josh

  • Support Staff

December 9, 2014 at 1:41 pm

Please enter them as:

2925

and

3225

for each ticket respectively. (no currency sign)


IFMA Toronto

December 9, 2014 at 1:42 pm

The issue is not that it is not being saved to the database. The issue is in the display of the price in the ticket selector. So far I have narrowed it down to:


EEH_Template::format_currency( $ticket_price );

If I remove the format_currency method it displays the price correctly.


IFMA Toronto

December 9, 2014 at 1:47 pm

This may not be the final fix, but updating line 313 of EEH_Template.helper.php from

$amount = (float) $amount;

to

$amount = (float) preg_replace('/,/','',$amount);

seems to fix the issue.


Josh

  • Support Staff

December 9, 2014 at 2:36 pm

Hi Scott,

That is going to cause problems elsewhere. format_currency() is used in a lot of places. Has anything things else been modified on this site, like the ticket selector template?


IFMA Toronto

December 9, 2014 at 2:40 pm

No. The ticket selector file has not been modified.


Josh

  • Support Staff

December 9, 2014 at 2:51 pm

Hi Scott,

Can you restore the method back to the default and post a link to the event in question so we can investigate?


IFMA Toronto

December 9, 2014 at 4:13 pm

I have to leave the fix in place for our live site since the tickets are now on sale.

Here is a link to a test server with the event:

http://ifma.digunobeta.com/events/test-event-duplicate/

  • This reply was modified 9 years, 11 months ago by Sidney Harrell. Reason: move creds to note


Sidney Harrell

December 9, 2014 at 6:20 pm

The comma should be removed before the price gets to EEH_Template::format_currency( $ticket_price ). I logged it here: http://sidney.eetesting.info/desktop/EE4-master/?espresso_events=event-2 and it is 12345.67. In the database it is stored as 12345.670. You are showing a comma in the price in the DB?


IFMA Toronto

December 9, 2014 at 6:42 pm

The price is stored without the comma (2925 and 3225)


Sidney Harrell

December 9, 2014 at 6:57 pm

Can you see if the ticket is returning the ticket price with or without the comma in modules/ticket_selector/templates/ticket_selector_chart.template.php, line 47?


Josh

  • Support Staff

December 10, 2014 at 9:59 am

Hi Scott,

I noticed that the price displayed on ticket selector doesn’t include the tax. Are you using the FHEE__ticket_selector_chart_template__ticket_price in a functions file to change it? If so, you’ll want to make sure that you’re returning a float value for the subtotal/base price. The following example will return a float:


IFMA Toronto

December 10, 2014 at 10:30 am

Yes I had used the code snippet “Display the base price of the ticket in the ticket selector” from this page: https://eventespresso.com/wiki/useful-php-code-snippets/

I have now removed the preg_replace from the format_currency method and put it into that snippet instead. I updated the return line to be:

return (float) preg_replace( '/,/','',$ticket->base_price()->get_price_without_currency_symbol() );

Seems to fix the problem.


Josh

  • Support Staff

December 10, 2014 at 12:45 pm

You can avoid the preg_replace if you do this instead:

return $ticket->get_ticket_subtotal();

Viewing 24 reply threads

The support post ‘EE4: Thousands separator in ticket price’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso