Preselect next events occurrence to display tickets

WordPress Event Management, Calendars & Registration Forums Request A Feature Preselect next events occurrence to display tickets

This topic contains 4 replies, has 2 voices, and was last updated by  Stephen Harris 10 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #9524

    This one is crucial. We allredy had customers calls asking us how about the tickets pricing because they are only visible when cliked on the datepicker. This may be the right programmers-logic but not the expected behaviour. Usually tickets are on other websites visible right from the start.
    Also it may be confusing to find the right date that can be clicked. We’ve got workshops that reoccur in 3 months – then it’s neccessery to click three times forward to find that date. This is to much for the small brains of the most customers.

    In the moment we use this workaround that performs this trick with jquery. It’s placed in our child theme in eo-booking-form.php :

    //--------------------------------------------------------------------------------------------------
    //  Get the next occurrence date and click on it via jQuery to reveal tickets an pricing info
    //  Author: Augenpulver
    // -------------------------------------------------------------------------------------------------
        $this_event_id = $booking_form->get('event_id');                
        $next_event_occ_date = get_closest_occurrence_of($this_event_id); 
    
            if($next_event_occ_date)
            {
    
                echo "
                    <script type='text/javascript'>
    
                        jQuery(function() {
                            setTimeout(function(){
                                jQuery('#eo-booking-occurrence-picker').datepicker('setDate', '{$next_event_occ_date}');
                                jQuery('#eo-booking-occurrence-picker .ui-state-active').click();
                            }, 1000);
                        });
    
                    </script>
                ";
            }
            else
            {
                 if(current_user_can( 'manage_options' ))
                 {
                    $curr_debuginfo = __FILE__.__LINE__;
                    echo "
                        <script type='text/javascript'>
                            console.log('{$curr_debuginfo}');
                            console.log('Sorry, No next event found for event id {$this_event_id}');
                        </script>
                    ";
                 }
            }

    And the function:

    //--------------------------------------------------------------------------------------------------
    //  Returns the next occurrence of the current event 
    //  Author: Augenpulver
    // -------------------------------------------------------------------------------------------------
    
    function get_closest_occurrence_of($post_id)
    {
            $occur_array =  eo_get_the_future_occurrences_of($post_id);
            if($occur_array)
            {
                if($occur_array)
                {
                    foreach ($occur_array as $value) 
                    {
                        $date = $value["start"];    
                        $occur_datelist[] = $date->format('Y-m-d');
                    }
                    return $occur_datelist[0];
                }
                else 
                    return false;
            }
            else 
                return null;
    }
    
    // -------------------------------------------------------------------------------------------------

    Even if this works very fine it would be great to not be forced to fake around some day to achieve this.

    Adrian Maleska
    #9525
    Adrian Maleska
    #9535

    We allredy had customers calls asking us how about the tickets pricing because they are only visible when cliked on the datepicker. This may be the right programmers-logic but not the expected behaviour.

    Totally agree on this – I had be meaning to address the problem that the datepicker opens on todays date, not the date of the next occurrence, which would much more useful (particular when booking long in advance). 1.6 is about to go out the door, but I think this is something that can be addressed fairly easily now – particularly since 1.6 brings a more structure javascript API.

    If there isn’t a ‘next event’, that isn’t an issue because the booking form shouldn’t display anyway.

    This is also ties in well with VAT (having tickets/prices automatically appear gives the VAT row some context!).

    Thank you for the feedback, and for posting your current solution 🙂

    Stephen Harris
    #9538

    I’m glad to hear that you already thought about solving this anyways. This would be a gain having this in 1.6. Please drop a word if it’ll be included in the new release so we can deactivate our hackish code. You’re totally right about the else statement – it’s unnecessary. But somehow it’s in my genes to think about exceptions … maybe I’ll become a proper coder laugh

    Adrian Maleska
    #9879

    Just a note to say, this was included in 1.6

    Stephen Harris
Viewing 5 posts - 1 through 5 (of 5 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.