• Resolved kongceng

    (@kongceng)


    Hello, I have a small problem with the search engine, I use the ajax filter plugin and it works the same as the ajax result of the search engine, once I finish writing the word and I give it enter, it returns the products I need but after this if I try to search the filters it does not return the products with the filter that I need.

    What I mean is that if I do a search and it returns 20 results and when I use the ajax filter and filter by category it should return the matching products, for example 6 but it keeps returning 20, and if I use ajax Separate filter and filter by the same category brings me the products that match the filter.

    I would like to know what happens, I have version 2.14 pro.

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

    (@mihail-barinov)

    Hello,

    Can you please give me the link to the ajax filter that you are using so I can test it?

    Regards

    Thread Starter kongceng

    (@kongceng)

    I’m working on the project at the moment locally, but I have a demo where you can try it, it’s http://balbico2.esundemo.com.ar/

    Link dekl ajax product filter plugin
    http://docs.berocket.com/plugin/woocommerce-ajax-products-filter?utm_source=paid_plugin&utm_medium=settings&utm_campaign=ajax_filters#for-users

    Ajax Search is works
    Filter Ajax is works
    Searh is work
    Search(enter) with ajax filter search not work, brings the same results with the search enter

    Plugin Author ILLID

    (@mihail-barinov)

    Looks like now I understand the issue.
    Please try to use following code snippet

    add_action( 'wp_head', 'aws_wp_head' );
    function aws_wp_head() { ?>
        <script>
    
            function getUrlParams() {
    
                var urlParams = {};
                var match,
                    pl = /\+/g,  // Regex for replacing addition symbol with a space
                    search = /([^&=]+)=?([^&]*)/g,
                    decode = function (s) {
                        return decodeURIComponent(s.replace(pl, " "));
                    },
                    query = window.location.search.substring(1);
    
                while (match = search.exec(query)) {
                    urlParams[decode(match[1])] = decode(match[2]);
                }
    
                return urlParams;
    
            }
    
            window.addEventListener('load', function() {
                var forms = jQuery(".aws-container form");
                forms.on('submit', function(e) {
                    var $this = jQuery(this);
                    var urlParam = getUrlParams();
                    if ( urlParam["filtros"] ) {
                        $this.append( jQuery( '<input type="hidden" name="filtros" value="">' ) );
                        $this.find('input[name="filtros"]').val( urlParam["filtros"] );
                    }
                });
            }, false);
    
        </script>
    <?php }

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Search result problem when using ajax filter woocommerce plugin’ is closed to new replies.