Hide worker choice, display all available slots

Support forumCategory: QuestionsHide worker choice, display all available slots
smartalek asked 2 years ago
Hi Nikola, is there a way to display all available time slots without requiring the customer to choose a worker first?

In our setup, there is only one service and it really doesn't matter which worker performs it. If there are multiple workers per slot then random assignment would be ideal.

Thank you for your advice.

Max Heise
smartalek replied 2 years ago

Also: We would be willing to pay a reasonable fee/get the extension package for this additional functionality.

smartalek replied 2 years ago

One way to go would be to offer an “any” option in the Worker drop down menu resulting in some kind of wildcard sql query (e.g., “worker LIKE ‘%'” in WHERE clause…) Any help/pointers?

Lars replied 2 years ago

Quick fix. Put it in your functions.php. This will select the last available worker after selecting the location. The if clause must be changed to your desires.

add_action(‘wp_footer’, ‘appointments_js’);
function appointments_js(){
if(get_the_id()==YOUR_PAGE_ID_WHERE_YOU_USE_EA) {
$output =<<<EOF

jQuery(document).ready(function($){
$(‘select[name=”location”]’).change(function(e) {
setTimeout (function() {
$(‘select[name=”worker”]’)
.find(‘option:last-child()’)
.prop(‘selected’,true)
.trigger(‘change’);
},1000);
});
});

EOF;
echo $output;
}
}