Custom field filters – selectors : Night Duration

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

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32839
    wankhee93
    wankhee93
    Participant

    Hello Ernest Marcinko,

    As topic please refer to screenshot. Is there a way to create a selectors ( Above 15 Nights ) with other duration that i state in screenshot? i seems cant find a way. Please advice

    Regards

    • This topic was modified 1 year, 5 months ago by wankhee93 wankhee93.
    Attachments:
    You must be logged in to view attached files.
    #32853
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    With a radio button filter it is not possible I’m afraid, you need a range slider for that.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #32856
    wankhee93
    wankhee93
    Participant

    Hello Ernest Marcinko,

    Is it possible like:

    16::TO::100||Above 15 Nights

    or i must list out:
    16::17::18::19::20::21::22::23 etc until ::100||Above 15 Nights ?
    Actually we prefer radio.

    Regards

    #32866
    Ernest Marcinko
    Ernest 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..

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.