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
Adrian Maleska
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
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
Just a note to say, this was included in 1.6
Stephen Harris