`tribe_events_ticket_is_on_sale` returning wrong result

Home Forums Calendar Products Events Calendar PRO `tribe_events_ticket_is_on_sale` returning wrong result

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1173979
    J Huffman
    Participant

    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 against time() 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?

    #1174669
    Andras
    Keymaster

    Hey 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,
    Andras

    #1174815
    Andras
    Keymaster

    Good 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,
    Andras

    #1175269
    J Huffman
    Participant

    Hi 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!

    #1175365
    Andras
    Keymaster

    Hey 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

    #1175370
    Andras
    Keymaster

    This reply is private.

    #1186906
    J Huffman
    Participant

    Hello,

    Any updates on a fix?

    #1187400
    Andras
    Keymaster

    Hi 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

    #1197453
    Support Droid
    Keymaster

    Hey 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 Team

    #1543410
    Victor
    Keymaster

    Hi 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

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘`tribe_events_ticket_is_on_sale` returning wrong result’ is closed to new replies.