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 11 years, 5 months ago.
-
AuthorPosts
-
February 13, 2014 at 7:18 pm #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
February 13, 2014 at 7:20 pm #9525You can see this in action here:
http://www.digital-art-school.de/cinema-4d-lightning-illumination-training/Adrian Maleska
February 13, 2014 at 11:17 pm #9535We 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
February 14, 2014 at 10:44 am #9538I’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
March 5, 2014 at 10:56 am #9879Just a note to say, this was included in 1.6
Stephen Harris
-
AuthorPosts
The forum ‘Request A Feature’ is closed to new topics and replies.