Home › Forums › Calendar Products › Events Calendar PRO › `tribe_events_ticket_is_on_sale` returning wrong result
- This topic has 10 replies, 5 voices, and was last updated 5 years, 10 months ago by Victor.
-
AuthorPosts
-
October 7, 2016 at 6:09 pm #1173979J HuffmanParticipant
Hello,
I’m attempting to troubleshoot an issue we’re having with the
tribe_events_ticket_is_on_sale
function. I have the following code in the event page:<?php if(tribe_events_has_tickets() and tribe_events_ticket_is_on_sale($ticket) == false): ?> <?php if(tribe_events_has_soldout() == false): ?> <span class="h4" style="font-family: 'Oswald', sans-serif; color: red;"> Online ticket sales have ended. Limited tickets available at the door! </span> <?php endif; ?> <?php endif; ?>
Today we noticed that it was rendering this text on the page before ticket sales had ended. It was clear ticket sales hadn’t ended because the quantity dropdown and “Add to cart” button was rendered below.
I did some digging and it appears the ticket’s end sales date is stored in local time (PDT) while the comparison in
tribe_events_ticket_is_on_sale
is againsttime()
which returns the time in UTC. This results in 7 hours time where this function is returning the wrong value.Attached is a screenshot with some output that describes what I’m seeing.
Any insight on how to go about fixing this?
October 10, 2016 at 2:00 pm #1174669AndrasKeymasterHey leehuffman,
Thanks for reaching out to us. I will check with one of the developers and will let you know.
Thanks for your patience!
Cheers,
AndrasOctober 11, 2016 at 1:43 am #1174815AndrasKeymasterGood morning leehuffman,
I managed to talk to one of our developers. It looks like this is a glitch in our plugin. I filed an internal bug ticket for it so should be resolved in the future, however I cannot give any estimates on this just yet.
I am going to close this ticket to new replies, but the issue is still open and we will update this ticket once we release a fix.
If you have any new questions or issues please create a new ticket and reference this one. We’ll be glad to help out!
Thanks and cheers,
AndrasOctober 11, 2016 at 11:41 pm #1175269J HuffmanParticipantHi András,
How would I go about overriding this function on my own? I know how to implement the fix in the function but I’m new to WordPress and not sure where to place that so that I don’t have to modify the file that’s distributed with your plugin; similar to how I’d go about modifying theme files without touching the ones that are distributed with the plugin.
Any guidance would be much appreciated. Thank you!
October 12, 2016 at 7:54 am #1175365AndrasKeymasterHey leehuffman,
I’m not quite sure if it’s possible to override a function. You would need to do that in the core file.
If you manage to implement a fix, would you be kind enough to share it with us?
Modifying the templates is absolutely possible. These guides should help you get started on this:
https://theeventscalendar.com/knowledgebase/themers-guide/
https://theeventscalendar.com/knowledgebase/template-overview/
Hope this helps! Let me know if you have any other question!
Cheers,
Andras
October 12, 2016 at 7:57 am #1175370AndrasKeymasterThis reply is private.
November 3, 2016 at 3:56 am #1186906J HuffmanParticipantHello,
Any updates on a fix?
November 3, 2016 at 3:24 pm #1187400AndrasKeymasterHi Lee,
Unfortunately I cannot give you any good news yet on the ticket, I’m sorry.
There are 2 workarounds that I can suggest.
1. Set the cutoff date 7 hours earlier. (I’m sure you thought of that.)
2. You can take the ticket end date and convert it to UTC time.
Would any of these help?
Andras
November 25, 2016 at 8:35 am #1197453Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support TeamMay 31, 2018 at 4:08 pm #1543410VictorKeymasterHi Lee!
Just wanted to share with you that a new release of our plugins is out, in which this issue is no longer present. We think this was already fixed in a previous version of our plugins, with changes made in other parts of the code.
Find out more about this release → https://theeventscalendar.com/maintenance-release-for-the-week-of-27-may-2018/
Please update the plugins and see if it works for you. Don’t hesitate to open a new topic if anything comes up.
Best,
Victor -
AuthorPosts
- The topic ‘`tribe_events_ticket_is_on_sale` returning wrong result’ is closed to new replies.