• Resolved ilythia

    (@natureonemockups)


    Hi there!

    I’m using Advanced Woo Search in combination with the BeRocket filter plugin on my shop page. Now I have two options filtering…

    1. I use the AWS first and any BeRocket filter afterwards > works fine (both filters are applied).
    2. I use the BeRocket filter first and AWS afterwards > doesn’t work (only AWS filter is applied and BeRocket filter is cleared).

    Is that normal? I wish it would work for both search variants. Please let me know if that’s possible.

    Another problem is that when I search for example for “red” it shows all red products first but it lists all other products, too. What do I have to do to see ONLY red products after my search?

    Best,
    Ilythia

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

    (@mihail-barinov)

    Hello,

    Please try to use following code snippet

    add_action( 'template_redirect', 'tp_redirects', 1 );
    function tp_redirects() {
    
        if ( isset( $_GET['type_aws'] ) && ! isset( $_GET['filters'] ) ) {
    
            $prev_url = $_SERVER['HTTP_REFERER'];
    
            if ( $prev_url ) {
                $parse_url = parse_url( $prev_url );
                if ( isset( $parse_url['query'] ) && $parse_url['query'] ) {
                    parse_str( $parse_url['query'], $prev_url_queries );
                    if ( isset( $prev_url_queries['filters'] ) ) {
                        $current_url = $_SERVER["REQUEST_URI"] . '&filters=' . $prev_url_queries['filters'];
                        wp_redirect( $current_url, 301 );
                        exit();
                    }
                }
            }
    
        }
    
    }

    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.

    This code will add BeRocket filter parameters to URL when using plugin search on a page where these filters were already applied.

    Regards

    Thread Starter ilythia

    (@natureonemockups)

    Hi there,

    thanks for the code! I used Code Snippet to add it to my page but unfortunately nothing changed. :/

    Best,
    Nancy

    Thread Starter ilythia

    (@natureonemockups)

    Just found that there is a typo in:

    $current_url = $_SERVER["REQUEST_URI"] . '&filters=' . $prev_url_queries['filters'];

    URI = URL, I guess? But it’s still not working. ??

    marketwo

    (@marketwo)

    hi, post search filters don’t work for me. Always return 0 results

    • This reply was modified 4 years ago by marketwo.
    • This reply was modified 4 years ago by marketwo.
    Plugin Author ILLID

    (@mihail-barinov)

    @natureonemockups

    No, there is no typo.

    One more question – do you use BeRocket filter with ajax filtering? If so – please try to temporarily disable this ajax feature and test one more time with the code that I provided previously.

    Regards

    Thread Starter ilythia

    (@natureonemockups)

    Without AJAX enabled it’s working! ?? But there is no way to make it work without disabling AJAX (due to faster loading), isn’t it?

    Thanks so much for taking the time to look into that!

    Plugin Author ILLID

    (@mihail-barinov)

    Looks like I understand how to help you. You can still use AJAX filter but please go to the BeRocket settings page and inside SEO tab enable ‘Refresh URL when filtering’ option. This must solve the issue.

    Thread Starter ilythia

    (@natureonemockups)

    Now it works just perfectly! Thanks so much!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Compatibility with BeRocket Filter’ is closed to new replies.