• When i not fill the form i click on search icon but nothing happens( i just need to show all products then.. how to do that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hi,

    Looks like I found the solution for you. Please use following code snippet

    add_action( 'wp_head', 'my_aws_head' );
    function my_aws_head() { ?>
        <script>
            window.addEventListener('load', function() {
                jQuery('.aws-search-btn').on( 'click', function (e) {
                    var form = jQuery(this).closest('.aws-search-form');
                    var searchField = form.find('.aws-search-field');
                    if ( searchField.val() === '' ) {
                        searchField.val('awsfilter');
                        searchField.closest('form').submit();
                    }
                });
            }, false);
        </script>
    <?php }
    add_filter('aws_search_query_array', 'my_aws_search_query_array');
    function my_aws_search_query_array( $query ) {
        if ( strpos( $query['search'], 'awsfilter' ) !== false ) {
            $query['search'] = '';
            $query['relevance'] = '1';
        }
        return $query;
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Regards

    Thread Starter 2TheMoon

    (@ruskiller777)

    thanks but i see this text (( https://imgur.com/a/NNaqelO
    and one more question..function.php running one time only or every page load? its bad to edit functions.php every time because big code?

    Plugin Author ILLID

    (@mihail-barinov)

    It is running on every page load. But you can use caching plugins so it will executed only one time.

    Thread Starter 2TheMoon

    (@ruskiller777)

    if i use caching plugin it autimaticaly run one time only?
    can i delete this text on screenshot?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Empty text not works’ is closed to new replies.