Conditionally Hiding / Stopping a view from display I have two views, for taxonomy pages, one displays the products of the current term (using contextual filter "Content:has taxonomy term"), and other display the sub-categories of the term (using contextual filter "Taxonomy term: Parent term").

My problem is that I want to display product view only when I does not get any result in sub-category view.
I would use a block, then create a tpl.php file for the block and inside it put

&lt;?php

$view = views_get_view('view_name_of_subcategory');
$view-&gt;set_display('block_1');
$view-&gt;execute();
        // results are now stored as an array in $view-&gt;result
$count = count( $view-&gt;result );

if ($count = 0) { print views_embed_view('view_name_of_products','block_2' } 
else { print $view-&gt;render(); }

?&gt;


Replace block_1 &amp; block_2 with your actual machine name, you can find it here (see picture)



PS if ($count = 0) does  not work try if ($count = null)