Support

Home Forums Event Espresso Premium Event price – remove decimal

Event price – remove decimal

Posted: August 18, 2012 at 8:41 pm


Michael Watt

August 18, 2012 at 8:41 pm

In Japan, there is no decimal used within the currency system.
Is there a way to remove the decimal and trailing two 0’s from the event price?


Seth Shoultes

  • Support Staff

August 20, 2012 at 1:59 pm

The decimal placement is actually determined at the database level. For example, in the “wp_events_prices” table the “event_cost” column type is decimal(20,2). You might be able to modify the price columns in the database to reflect the pricing structure for your specific needs.

FYI. I think we are changing this in EE 3.2.


Tony Cosentino

August 26, 2012 at 4:47 am

Actually Seth that doesn’t work. It still displays the price with .00 at the end even though the database is not keeping any decimal places on file.

I made the following changes which didn’t have any effect on the price layout on the event page.
Anything else we can do that won’t be wiped by an update?

wp_event_attendee_cost table
cost: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0

wp_event_prices table
event_cost: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0
surcharge: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0
member_price: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0

wp_events_attendee table
total_cost: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0
amount_pd: changed from decimal(20,2) to decimal(20,0) and changed the default from 0.00 to 0


Seth Shoultes

  • Support Staff

August 27, 2012 at 11:59 am

Sorry guys! It seems I was mistaken.

We use the PHP number_format() function to display/store price data in some places.

So, if you would like to override the format. Then you will need to use the Custom Files addon to override the functions that display the prices.

These three functions can be found in the event-espresso/includes/functions/pricing.php: event_espresso_get_final_price() event_espresso_price_dropdown() espresso_attendee_price()

You should be able to copy these functions into the custom_function.php file, then change the number_format() parameters to display the prices as needed.

Hope that helps.

  • This reply was modified 11 years, 8 months ago by  Seth Shoultes. Reason: Fixing a link


Michael Watt

August 29, 2012 at 12:33 am

Seth, thanks for your support.

I uploaded the 3 custom files
custom_includes.php
custom_functions.php
custom_shortcodes.php
according to EE’s instructions within the following folder:
/public_html/wp-content/uploads/espresso

I then edited a local copy of
event-espresso/includes/functions/pricing.php
changing 0.00 to 0 within the 3 areas that you instructed.

Finally, I copied those three sections of code that I edited:
event_espresso_get_final_price()
event_espresso_price_dropdown()
espresso_attendee_price()
into custom_functions.php, back on the server.

event_espresso_get_final_price() didn’t seem to change anything
event_espresso_price_dropdown() + espresso_attendee_price() left me with a white page

I’m wondering if you could kindly attach the correct code that I should append to custom_functions.php in order to resolve the trailing .00 issue ?


Chris Reynolds

  • Support Staff

August 29, 2012 at 10:42 am

We would need a custom development request to write the code for you. This is why it says on the page that the custom files add-on should be used by people familiar with PHP programming — we cannot provide support for custom code.

Have you tested your code with WP_DEBUG turned on to identify any programming errors?


Michael Watt

August 31, 2012 at 11:49 pm

Thanks for your reply, Chris.
Is there any chance that this might be resolved through the new version of EE that you guys are working on?

I am not comfortable with PHP programming yet my client needs a site that will correctly display prices in yen. (no trailing decimal and with a comma after the thousandth integer ie. ?3,000)


Chris Reynolds

  • Support Staff

September 4, 2012 at 1:49 pm

If Seth is saying that it would need to be custom programmed, then I would defer to him. He would know better than I would what’s going into the next 3.1 release since he’s been working with the code more than I have.


Dainius

October 7, 2012 at 6:33 am

Hi. Without adding custom_functions it can be done in pricing.php – just need to change all “, 2” to “, 0” everywhere in the code πŸ˜‰


Josh

  • Support Staff

October 8, 2012 at 11:51 am

If you make the changes directly to pricing.php, you’ll lose your changes on each update of Event Espresso. That’s why we recommend overriding this in the custom functions file.


Dainius

October 8, 2012 at 12:45 pm

I know that πŸ™‚ But I need to do to much changes! Almost in 1/4 of all files I changed something – currency right, not left, translated something, that isnt translated by language file, done some specific thinks, that must be done not only in template but in code too. I know that, that lost this job and because was writing few letters, asked about 3.2… dont want to start lot of special customisations and after month get new script and do all job again.

Most important thing – i want to customise as i need and leave it. Maybe for year. And again sit to huge upgrade and customisation from zero πŸ™‚

The support post ‘Event price – remove decimal’ 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