eo_get_bookings() doesn't work when filtering event list with searchform

WordPress Event Management, Calendars & Registration Forums Report A Bug eo_get_bookings() doesn't work when filtering event list with searchform

This topic contains 5 replies, has 2 voices, and was last updated by  Marciel Bartzik 5 years, 9 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #30484

    If I filter the event list on events archive page with the searchform (name, venue, category, time), the function eo_get_bookings() in template seems not to work correctly. Without using a filter everything is fine.

    I use this code on template file “eo-loop-single-event.php”:

    <?php
    $bookings = eo_get_bookings( array(
        'status'=>'reserved',
        'event_id' => get_the_ID(),
        'occurrence_id' => ''
    ) );
    $reservations = 0;
    if( $bookings ){
        foreach( $bookings as $booking ){
            $reservations += eo_get_booking_meta( $booking->ID, 'ticket_quantity' );
        }
    }
    ?>
    

    I’m using a own status “reserved”, but it’s the same with “pending” status.

    Without filter $bookings is an array with elements, with filter it’s an empty array.

    Marciel Bartzik
    #30485
    Marciel Bartzik
    #30490

    It seems that the bug depends on the fact, that the filters are working as a wordpress search by using ?s= in url, so that WordPress uses the search.php template to show the event list. If I manually kill this parameter from url, it works fine again.

    Marciel Bartzik
    #31011

    May I ask for help again?

    Marciel Bartzik
    #31017

    Hi Marciel,

    Are you using the event search shortcode? If so, it shouldn’t be using the ?s query parameter in the URL, but instead eo_search[s] query parameter.

    The query that gets passed to WP_Query does include s with the search term – but this shouldn’t impact the template that is used.

    Stephen Harris
    #31019

    Hi Stephen,

    I implemented it by using <?php eo_get_event_search_form(); ?> in archive-event.php as fixed part of the template file.

    Marciel Bartzik
Viewing 6 posts - 1 through 6 (of 6 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.