Home › Forums › Ticket Products › Event Tickets Plus › Decimal Separator
- This topic has 10 replies, 3 voices, and was last updated 9 years, 9 months ago by
Martin.
-
AuthorPosts
-
July 11, 2016 at 11:09 pm #1138534
Martin
ParticipantHi there,
this is not a bug, but a need:
I am running woo commerce and events tickets (plus) on a German website. In Germany the Decimal Separator is a “,” instead of a “.”
I have the right settings in Woocommerce, but with event tickets it doesn’t work. Event tickets only accepts the “.”
Is there a way to change that?
Thank you for getting back to me!
Regards
July 12, 2016 at 4:13 pm #1138927Nico
MemberHi Martin,
Thanks for reaching out to us! I’ll help you here…
As far as I could test our plugin is following what’s defined in WooCommerce settings (at least in the tickets form). Can you please send me a screenshot of the price without the Woo format? I’ll re-check on that location to see if I can reproduce this locally.
Thanks,
NicoJuly 13, 2016 at 2:18 am #1139046Martin
ParticipantHi Nico,
thank you for getting back to me. I am not exactly sure what screenshots you would like to see. So I have added 5. The first one is the settings for currency at woocommerce.
The second and the third one show what happens when I use a “.” in event tickets plus (this is: the “.” will be used on the frontage.
The fourth and the fifth one show what happens, when I use the “,”. On the fronted you will not see a price at all …
I hope this helps
July 13, 2016 at 2:22 am #1139051Martin
ParticipantLooks like the uploads did#t work… so here once again files 1 – 4
July 13, 2016 at 2:23 am #1139053Martin
Participantand here is screenshot No. 5
July 13, 2016 at 1:01 pm #1139326Nico
MemberHey Martin,
Thanks for following up! I get you know! It’s like the field is only accepting ‘.’ for decimals and not ‘,’. And in the cases where there’s a decimal part the in the price is showing as a ‘.’ in the front-end. This seems to be a bug in our code.
Paste the snippet below in your theme’s (or child theme’s) functions.php file, it should make it right for now:
/* Force comma as decima separator for event cost */
function tribe_convert_decimal_char ( $cost, $post_id, $with_currency_symbol ) {return str_replace ( '.' , ',' , $cost );
}add_filter( 'tribe_get_cost', 'tribe_convert_decimal_char', 10, 3 );
Also, next maintenance release 4.2.3 is coming out next week with various tweaks for tickets including some changes in how the price field is managed. I’m not sure if this is going to be fixed as there’s no actual tickets that refer to this particular glitch, but maybe the changes introduced makes this right or behave in a different way.
Please let me know if the snippet makes it right for now and in that case if you can wait till 4.2.3 is out to re-check this,
Best,
NicoJuly 13, 2016 at 2:00 pm #1139353Martin
ParticipantHi Nico,
thank you for the effort you put into this. It now works in this way: when I enter a price in event tickets using the “.” as a separator it will show up as a “,” in the front-end. So thank you very much for this.
While we are on this note I foo have a question and we don’t have to go there, but …
Over here it is quite common to write: € 30,-
This means 30,00 or like in the US it would probably be 30.00Is there a way to make that possible as well? Maybe you want to ad that to the changes for the next release or the one after that? Or maybe there is even a way to tweak it right now?
Just asking …
Again, thank you very much and have a great evening – at least we have it evening here right now …
Regards
July 14, 2016 at 2:03 pm #1139927Nico
MemberThanks for following up Martin! Glad to hear we are getting close to have this as you need 🙂
Indeed the snippet is for the front-end display but you still need to input the price in the ‘10.50’ format in the back-end.
Over here it is quite common to write: € 30,-
No problem, let’s look into making the snippet more complete:
/* Custom format for event cost */
function tribe_custom_cost_fomat ( $cost, $post_id, $with_currency_symbol ) {if( $cost == '' || $cost == 'Free' || $cost == 'Eintritt frei' ) return $cost;
$cost = str_replace ( '.' , ',' , $cost );
$cost .= ',-';return $cost;
}add_filter( 'tribe_get_cost', 'tribe_custom_cost_fomat', 10, 3 );
Please update the snippet and let me know if it works as expected,
Best,
NicoJuly 14, 2016 at 2:27 pm #1139937Martin
ParticipantHi Nico,
thumbs up – works perfect. Do I need to watch it when the update comes to make sure the update doesn’t change anything here?
Anyways, thank you for your help – makes using the plugin even more pleasant …
Best regards!
Martin
July 14, 2016 at 6:09 pm #1140041Nico
MemberStocked to hear Martin! Thanks for the kind words 🙂
Do I need to watch it when the update comes to make sure the update doesn’t change anything here?
Plugin updates shouldn’t make this customization go south (be sure to check it once in a while though), but if you are not using a child theme and the theme receives an update then it might override the functions.php file and the snippet will be wiped out. You can create a child theme to address this or use a plugin like Code Snippets to store snippets.
I’ll log this bug but I’m not sure when it will be fixed so stay tuned to our upcoming release notes! I’m closing out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Have a great weekend,
Nico -
AuthorPosts
- The topic ‘Decimal Separator’ is closed to new replies.
