Trouble resetting the search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Trouble resetting the search

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 year, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31972
    xbarbot87
    xbarbot87
    Participant

    Hi there,

    I’d like to know how we can properly reset a user search, when we type in a term and simply hit backspace, it does work, the list of terms is reset but when we click on the black cross to delete the term in one click, it doesn’t reset the list.

    Link here: https://www.tti-online.com/glossary-2/

    Thanks,

    #31995
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    That button is only to clear the search phrase from the input field. However I might be able to suggest a custom code.

    Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!

    add_action('wp_footer', 'asp_trigger_search_on_close');
    function asp_trigger_search_on_close() {
    	?>
    	<script>
    	jQuery(function($){
    		$('.proclose svg').on('click touchend', function(e){ 
    			var $e = $(this).closest('.asp_w');
    			setTimeout(function(){
    				ASP.api($e.data('id'), $e.data('instance'), 'searchFor');
    			}, 250);
    		});
    	});
    	</script>
    	<?php
    }
    Best,
    Ernest Marcinko

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


    #32003
    xbarbot87
    xbarbot87
    Participant

    Many thanks for that, it works well! The only problem is that it reverses the alphabetical order, any idea why?

    Thanks,

    #32005
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Well, because this triggers an actual search for an empty phrase, and if the ordering is set by relevance (default), then the items are shown by that order. To get the original state the page would have to be completely reloaded.

    Best,
    Ernest Marcinko

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


Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.