This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Custom field filters – selectors : Night Duration

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Custom field filters – selectors : Night Duration Reply To: Custom field filters – selectors : Night Duration

#32866
Ernest MarcinkoErnest Marcinko
Keymaster

That way is not possible, but you can try custom coding to map values and change the operator via the asp_query_args hook:

add_filter("asp_query_args", "asp_query_args_change", 10, 2);
function asp_query_args_change($args, $search_id) {
  foreach( $args['post_meta_filter'] as &$filter ) {
	if ($filter['key'] == 'nights_duration') {
		if ( strpos($filter['value'], '--') !== false ) {
			$filter['value'] = explode('--', $filter['value']);
			$filter['operator'] = "BETWEEN"; 
		}
	}
  }
  return $args;
}

..then use the range values like:

1--3||1-3 Nights
4--6||4-6 Nights

etc..