WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Hide price when it is zero (8 posts)

  1. AJD
    Member
    Posted 6 months ago #

    I am inserting a booking price into the events sidebar widget.

    If I use it like this:

    {has_bookings}<li>#_EVENTPRICERANGE</li>{/has_bookings}

    The result displays 0.00 even on events with booking disabled.

    How to show the booking price in the sidebar widget only if bookings are enabled for that event?

    Thanks.

    http://wordpress.org/plugins/events-manager/

  2. angelo
    NetWebLogic Support
    Posted 6 months ago #

    I tried this one and seems to be working fine however could it be that the events is fully booked and/or you have free tickets?

  3. AJD
    Member
    Posted 6 months ago #

    Hi, yes, some of the events had the free default ticket still showing. Some of them were past the booking deadline. It seems to show $0 if the event is fully booked or past its booking deadline.

    Is there a way to change this? It would better to have a message like in the events page where it says: "Bookings are closed for this event."

    Thanks

  4. angelo
    NetWebLogic Support
    Posted 6 months ago #

    yes, you can override that or create your own using this tutorial - http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/

    *you can see the original snippet at events-manager/classes/em-event.php at around lines 1549-1574

  5. AJD
    Member
    Posted 6 months ago #

    Just to clarify. When a booking has past its deadline or is fully booked the intended output of '#_EVENTPRICERANGE' is '$0.00'?

    If so, my question is: "How to show the price range of an event and when the bookings are full show: "Bookings Full" or if passed the deadline show: "Booking Deadline Passed" ?

    It sounds like the only solution is to make a custom placeholder, however I do not see how lines 1549-1574 of em-event.php relates to that. I don't see any reference there for the output of #_EVENTPRICERANGE.

    Thanks.

  6. philipjohn
    Member
    Posted 6 months ago #

    Hiya,

    It is likely that you will need your own custom placeholder for this, yes.

    I'm afraid I'm not sure what Angelo was pointing to in em-event.php so perhaps he can provide an answer there.

    Thanks,
    Phil

  7. AJD
    Member
    Posted 6 months ago #

    Okay, thanks.

    The behavior of defaulting to $0.00 for events that are passed, or full or even events that don't have booking enabled seems a bit clunky.

    However, I am close to finding a solution using nested conditional tags like this:

    {has_bookings} <!-- Check that an event has bookings, so we don't show '$0.00 - $0.00' on all events. -->
    
    {fully_booked}Fully Booked.{/fully_booked}<!-- In case all tickets are sold. -->
    
    {is_future} <!-- Then check to make sure that the event is future, so we don't show '$0.00 - $0.00' as the price for an event that has passed. -->
    
    <span class="em_cost">#_EVENTPRICEMIN - #_EVENTPRICEMAX</span> <!-- show the price range on all future events with booking enabled. -->
    
    {/is_future}
    {/has_bookings}
    
    {is_past}Event is over.{/is_past}<!-- If the event is over. -->

    I also needed to add:

    define('EM_CONDITIONAL_RECURSIONS',2);

    in wp-config.php

    -Cheers

  8. caimin_nwl
    NetWebLogic Support
    Posted 6 months ago #

    Cool. Thanks for posting an update, it'll probably help someone else out.

Reply

You must log in to post.

About this Plugin

About this Topic