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 4 years, 6 months ago.
- AuthorPosts
- October 2, 2019 at 12:32 pm #24188You cannot access this content.October 3, 2019 at 9:41 am #24198
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 :)
October 3, 2019 at 11:07 am #24200You cannot access this content.October 4, 2019 at 9:41 am #24205Hi 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 :)
October 4, 2019 at 12:58 pm #24217You cannot access this content.October 5, 2019 at 8:38 am #24221You cannot access this content.October 7, 2019 at 1:54 pm #24230Hi,
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:
Best,// 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; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 7, 2019 at 3:21 pm #24235You cannot access this content. - AuthorPosts
You must be logged in to reply to this topic.