Tell us what you are trying to do? Trying to reinitiate blank view if a user selects default dropdowns. Essentially, default dropdown should be set to None rather than All posts.
To do so, as per my prior ticket request, I wrapped the View Loop in Conditional :
NOT ( empty( '[wpv-search-term param='wpv_view_count']') )
This works when a user first loads the page and has not made a dropdown selection. But once they make a selection, the view never resets to blank even though both dropdowns are returned to their initial default selection. This is a deal killer for me for this software if a solution cannot be easily implemented.
Is there any documentation that you are following? Looked through every ticket on this subject without resolution.
Is there a similar example that we can see? After reading through so many support tickets, it seems like this is a very popular request None vs All with the norm being None not All as it seems to be set now. None would be the norm for not making a selection. Was the Toolset code written backwards? Any plans to add this to the next release?
Hello. Thank you for contacting the Toolset support.
Can you please share problem URL and steps I should follow to see the issue.
As I understand - you would like to display no result if both dropdown are set to defeat option "please select" is that correct?
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I checked and I can see that you are using the AJAX filter view and you select the option "AJAX refresh when changing any filter" that means whenever you will change the filter it will update the result and that is expected and this is how it used to work by default.
If you want that until and unless user select values from the both the dropdown then you will have to select the option "Full page refresh when clicking Submit" or "AJAX refresh when clicking submit" and you will require to add the "Submit" button to your search form.
But really the issue is the same. Using a submit button doesn't solve the problem. The problem with the Toolset default configuration is that it is choosing ALL as default not NONE. So in your example it works the same way if I use a submit button. Because once a user goes back to Default setting (option 1 in the dropdown box) the view results will be ALL products or all shops depending on the page. It should be NONE. The better solution for Toolset would be to give us the option of choosing whether we want the user to see default ALL items or NONE. So once again, until Toolset gets on board with this option I need the ability to make that happen. Default must be NONE not all items. Please let me know how I accomplish that and I guarantee you will be solving this for many Toolset purchasers that have requested the exact same thing.
Can you please tell me - Did you added any view's filter so that it does not displaying any results on initial page load? If yes - Can you please tell me where you added that code?
OR
Tell me how you are not displaying the result on initial page load?
Yes, in both Locator page and Template for Products I use a conditional block in the View Output which is:
NOT ( empty( '[wpv-search-term param='wpv_view_count']') )
This was provided by another Support Team Member. However it only works the first time a user comes to the page once they do a search and then go back and try the default Select it shows ALL items again....
At the start yes, but, after doing an initial search if I return to Select (default option) there are no other dropdowns just Select, the rest have disappeared.
I've disable the previous hook and added the following hook to "Custom Code" section offered by Toolset:
add_filter( 'wpv_filter_query_post_process', 'prefix_modify_empty_query', 10, 3 );
function prefix_modify_empty_query( $query, $view_settings, $view_id ) {
if(defined( 'DOING_AJAX') and DOING_AJAX ) {
foreach($_POST['search']['dps_general'] as $k=>$v):
if(
($v['name']=='wpv-wpcf-state' and $v['value']=='')
or
($v['name']=='wpv-relationship-filter' and $v['value']==0)
){
$query->posts = array(); // add the default post to the posts result array
$query->found_posts = 0; // modify the count of found posts
$query->post_count = 0; // modify the count of displayed posts
}
endforeach;
}
return $query;
}
Also, I found if the user refreshed the page we are back to square one with ALL shops being displayed despite the default Select on both Wine and State...