Home › Forums › Calendar Products › Events Calendar PRO › Cost field used to support text
- This topic has 6 replies, 3 voices, and was last updated 8 years, 7 months ago by Support Droid.
-
AuthorPosts
-
September 5, 2015 at 8:08 pm #1002478pickleshyParticipant
Hi,
I’ve been running ECP since January 2014 on this site: http://livemusicproject.org/calendar/
I am currently upgrading the event calendar plugins (Event Calendar, ECP, Community Events) on my staging site, making the large leap from 3.92 to 3.11.2.
Until now, it has been possible to treat the cost field as a text field, which enabled me to support the following price descriptors:
• $10-$25
• $20 ($10 student/senior)
• $10 (age 12 & under free)In my general settings, I did not elect to place a currency symbol before or after the price.
Looking at the latest updates on my staging site, I see that the cost field is now attempting to turn all price descriptors into a range, stripping out all formatting that is not a number (and at times, stripping out the numbers as well). Thus, all existing cost data is transformed when it does not conform to a narrow standard:
• $10-$25 –> becomes 10
• $20 ($10 student/senior) –> becomes 20
• $10 (age 12 & under free) –> becomes 10See testing event here: http://stage-seattle.livemusicproject.org/event/test-event-to-test-dolla-dolla-signs/
It appears this transformation is occurring upon retrieval/display, and the cost data is, in fact, intact in the database.
Is there a way to escape this sterilization process and maintain the integrity of my cost data on display, so that the hundreds of existing events on my site remain accurate?
- This topic was modified 8 years, 7 months ago by pickleshy.
September 7, 2015 at 8:46 am #1002628NicoMemberHi @pickleshy,
Thanks for reaching out to us! Hopefully I can help you out on this 🙂
Check out this snippet Barry provided to other customers having the same issue: https://theeventscalendar.com/support/forums/topic/cost-format/#dl_post-989616
Please let me know if it does the trick for you,
Best,
NicoSeptember 7, 2015 at 9:09 am #1002645pickleshyParticipantAwesome, I’ll try it! Thanks!
September 8, 2015 at 11:35 am #1003018NicoMemberGreat, just let me know about it!
Best,
NicoSeptember 8, 2015 at 5:53 pm #1003119pickleshyParticipantHi Nico,
For the most part it works great! The one issue we still have is that when the cost of an event is 0, the “Free” label goes away (the entire label is hidden).
We’re thinking of using the following workaround:
function verbatim_cost_field( $cost, $post_id ) { $freeStr = "free"; $pos = stripos($cost, $freeStr, 0); if ($pos !== false) { return $cost; } return esc_html( get_post_meta( $post_id, '_EventCost', true ) ); } add_filter( 'tribe_get_cost', 'verbatim_cost_field', 10, 2 );
Does that look about right to you?
September 9, 2015 at 8:22 am #1003307NicoMemberHey @pickleshy,
That looks good indeed, thanks for sharing 🙂
In guess you tested that out and fixes the “0” issue right?
Best,
NicoSeptember 24, 2015 at 7:05 am #1008255Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Cost field used to support text’ is closed to new replies.