Skip Navigation

[Resolved] “No Results” code does not display unless all three filters are selected

This thread is resolved. Here is a description of the problem and solution.

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by aaronS-3 4 years ago.

Assisted by: Luo Yang.

Author
Posts
#2128215
Screen Shot 2021-07-28 at 3.50.03 PM.png

Tell us what you are trying to do?
When you "filter" results, there should be some "no results" code that runs. Right now there are no available apartments so that code should run every time. When we added a few Apartments for testing, the "No results" message will only show if there is a value for Locations, Bedrooms and Availability. When you keep them at "All", it will not show the "no results" message.

Is there any documentation that you are following?
Not that I can find.

Is there a similar example that we can see?
If you click "Filter", the "no results" message will not show. If you click on "Available Apartments -> Available Next Three Months" in the Navi, the no results message WILL show

What is the link to your site?
hidden link

#2128567
no-item.JPG

Hello,

I assume we are talking about this URL:
hidden link
See my screenshot no-item.JPG
It does output message as you mentioned above:
No apartments currently available match that search. Please check back later; apartments are updated regularly.

Is this problem resolved? please let me know if you need more assistance for it. thanks

#2129213

Try using the filter again after you get that message. The message goes away and will no longer show.

hidden link

#2129437

When you do not see the "no results" message, that means there are some result in views loop, you can edit the post view, in views loop display the post information, for example post title, you should see them in the result

If you need more assistance for it, please provide your website credentials in below private message box, I can setup a demo for you

#2132033

I have tried these in your website:
1) Edit post view "Main Available Apartments View", in section "Loop Output Editor", line 10, add the post link shortcode:
[wpv-post-link]

2) Test it in front-end:
hidden link
Field "BEDROOMS" choose option: 4 Bedrooms, click button "Filter", I can see the post links in the result area. Can you confirm it?

The problem is in post view "Main Available Apartments View", in section "Loop Output Editor", line 10, you are using below condition shortcode:
[wpv-conditional if="( '[wpv-post-taxonomy type='availability' format='slug' ]' ne '' )"][wpv-post-body view_template="Basic Apartment Boxes"][/wpv-conditional]
It conducts the problem you mentioned above, if you don't need it, you can remove [wpv-conditional] shortcode manually.

#2135087

We are still seeing the issue. I have re-created the conditions from the live site on staging. Our issue is that we want the "Join Our Waitlist" to display if there are no available apartments for lead generation. If you click the link below, we are expecting to see the "Join our waitlist" text and button since there are no results.

hidden link

#2135273

It seems that you have added some custom CSS codes in your theme file:
hidden link
line 785~787:

/* Removes added URLS on Apartment Views Page */
.type-box .row > a {
    display: none;
}

Above CSS codes will hide the result of views, but it can not display the "no item found" result

In your case, it needs to use custom codes to add another taxonomy filter into Views query, filter the results which have terms in taxonomy "availability", I have done below modifications in your website:
Edit your theme file "functions.php", line 234~247, add below codes:

add_filter( 'wpv_filter_query', 'availability_EXISTS_func', 999, 3 );
function availability_EXISTS_func( $query_args, $views_settings, $view_id) {
	$view_ids = array( 78 );
	if (in_array($view_id, $view_ids)){
		if(!isset($query_args['tax_query'])){
			$query_args['tax_query'] = array();
		}
		$query_args['tax_query'][] = array(
			'taxonomy' => 'availability',
			'operator' => 'EXISTS',
		);
	}
	return $query_args;
}

More help:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query
https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters

#2135799

My issue is resolved now. Thank you!