Is it possible that a selection from a drop-down menu becomes unavailable after a certain number of bookings?
I am taking ticket bookings and they are in batches and I would like to have certain batches become unavailable after a certain amount of bookings.
Thanks for your help
Is it possible that a selection from a drop-down menu becomes unavailable after a certain number of bookings?
I am taking ticket bookings and they are in batches and I would like to have certain batches become unavailable after a certain amount of bookings.
Thanks for your help
Share Improve this question asked Nov 10, 2019 at 10:48 Gabriel CamilleriGabriel Camilleri 1 1- how do you fill the drop-down menu ? edit your question to show the form code. – Kaperto Commented Nov 10, 2019 at 11:15
1 Answer
Reset to default 0It is possible with the Smart Grid-layout Extension for CF7C plugin. The smart grid plugin has a [dynamic_dropdown]
tag which allows you to filter the options.
Replace your dropdown menu with a dynamic dropdown and in the tag Custom Source select the Custom tab, you can then populate the dropdown dynamically using,
add_filter('cf7sg_dynamic_dropdown_custom_options', 'filter_options',10,3);
function filter_options($options, $field_name, $form_key){
if($form_key != 'my-form') return $options; //check this is the correct form.
if($field_name != 'bookings') return $options; //check this is the correct field.
$options = array();
//load all your booking options.
foreach($bookings as $booking){
//verify if the booking limit is crossed.
if($booking->count < $limit){
$options[$booking->id] = $booking->title; //$options are $value=>$name pairs.
}
}
return $options;
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744983352a4604468.html
评论列表(0条)