pictures are not shown, drop down background

Home Forums Product Support Forums Ajax Search Pro for WordPress Support pictures are not shown, drop down background

This topic contains 37 replies, has 2 voices, and was last updated by Brigitte08 Brigitte08 4 years, 6 months ago.

Viewing 8 posts - 31 through 38 (of 38 total)
  • Author
    Posts
  • #24188
    Brigitte08
    Brigitte08
    Participant
    You cannot access this content.
    #24198
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Brigitte,

    Thank you, that worked. I think I see the problem here, it is a bit more complicated. What I didn’t assume, that a property can be occupied over multiple dates, so it is dependent on the date, and it cannot be stored within a single field. The calendars probably have a more complex data structure for that. The date filter in this case probably does nothing, as the availability cannot be determined by single field comparision.

    May I ask, which plugin do you use to manage the availability? I might be able to suggest a simple custom code to exclude the results, if they have an API to check by dates. Otherwise this might be only possible to resolve via customization.

    Best,
    Ernest Marcinko

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


    #24200
    Brigitte08
    Brigitte08
    Participant
    You cannot access this content.
    #24205
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Brigitte,

    Thank you. Unfortunately I could not find any functions related API.

    Can you please ask the developer if there is any function/method to get if a given date/date range is occupied? Something that accepts the accomodation ID and the dates as parameters and returns if the accomodation is available, or something similar to that. We could work out something with that.

    Best,
    Ernest Marcinko

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


    #24217
    Brigitte08
    Brigitte08
    Participant
    You cannot access this content.
    #24221
    Brigitte08
    Brigitte08
    Participant
    You cannot access this content.
    #24230
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    Thank you, that looks perfectly what I am looking for. Based on that, I looked at the source, and added an extra piece of code to the functions.php file in your theme directory to request the information from the calendar. Optimally it should exclude the items now, that the given function returns as not available. For future reference, I have added the following code:

    // AJAX SEARCH PRO SPECIFIC
    add_filter('asp_results', 'asp_filter_non_available_accomodations', 10, 4);
    function asp_filter_non_available_accomodations($results, $search_id, $is_ajax, $args) {
    	if ( !empty($args['post_meta_filter']) ) {
    		foreach ( $args['post_meta_filter'] as $filter ) {
    			$operator = $filter['operator'];
    			$value = $filter['value'];
    			$field = $filter['key'];
    			if ( $field == 'mphb_start_date' ) {
    				$from = $value . ' 00:00:00';
    			} else if ( $field == 'mphb_end_date' ) {
    				$to = $value . ' 00:00:00';;
    			}
    		}
    		if ( isset($from, $to) ) {
    			$dba = new HbDataBaseActions();
    			foreach ( $results as $k => $r ) {
    				if ( !$dba->is_available_accom($r->id, $from, $to) ) {
    					unset($results[$k]);
    				}
    			}
    		}
    	}
    	return $results;
    }
    Best,
    Ernest Marcinko

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


    #24235
    Brigitte08
    Brigitte08
    Participant
    You cannot access this content.
Viewing 8 posts - 31 through 38 (of 38 total)

You must be logged in to reply to this topic.