• Hi guys, quick question. I use Elementor Pro and WooCommerce. I noticed a strange behaviour for this plugin:

    I have this product: BMW 3-Series 2019+ (G20-G21) and the URL is:

    https://carsoundsecurity.co.uk/?s=&ymm_search=1&post_type=product&_make=BMW&_model=3-Series&_year=2019%2B%20(G20-G21)

    When I click on a filter, the + is ignored and the products associated with this model are not returned:

    https://carsoundsecurity.co.uk/p-rear-screens/?s&ymm_search=1&post_type=product&_make=BMW&_model=3-Series&_year=2019+%20(G20-G21)

    Filtering products without + in their titles works great. The problem is when the %2B is present.

    I started with this snippet, but then the %20 is ignored. Can you guys give me an idea about how can I handle special characters with your plugin? Many thanks!

    add_action('woocommerce_product_query', 'custom_year_filter');
    function custom_year_filter($query) {
    if (isset($_GET['_year'])) {
    $year = sanitize_text_field($_GET['_year']);
    if (strpos($year, '+') === false) {
    $year = str_replace(' ', '+', $year);
    $_GET['_year'] = $year;
    }
    }
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support fesupportteam

    (@fesupportteam)

    Hi @iulianmaftei

    Thank you for your interest in the Filter Everything plugin.

    Are you trying to filter posts on the search template page?

    Best Regards – Victor

    Thread Starter iulianmaftei

    (@iulianmaftei)

    Hi Victor,

    Thanks for your reply.

    I use the plugin to filter products in a product archive page.

    Best

    Plugin Support fesupportteam

    (@fesupportteam)

    Can you please send a link to the exact page with step-by-step instructions on how we can recreate this issue?

    Best Regards – Victor

    Thread Starter iulianmaftei

    (@iulianmaftei)

    Sure, here is quick screen recording with our issue.

    Many thanks

    Plugin Support fesupportteam

    (@fesupportteam)

    In the plugin folder /src/WpManager.php there will be a function:

        private function getRequestUri()
    {
    $postData = Container::instance()->getThePost();
    if( isset( $postData['flrt_ajax_link'] ) ){

    $home_url = home_url();

    if( flrt_wpml_active() ){
    $home_url = apply_filters( 'wpml_home_url', home_url() );
    }

    $parts = explode( '?', $home_url );
    $home_url = trim( $parts[0], '/' );

    $res = str_replace( $home_url, '', $postData['flrt_ajax_link'] );
    return $res;
    }

    return $_SERVER['REQUEST_URI'];
    }

    You can try to change it for something like this (this is not tested code)

    private function getRequestUri()
    {
    $postData = Container::instance()->getThePost();
    if (isset($postData['flrt_ajax_link'])) {

    $home_url = home_url();

    if (flrt_wpml_active()) {
    $home_url = apply_filters('wpml_home_url', home_url());
    }

    $parts = explode('?', $home_url);
    $home_url = trim($parts[0], '/');

    // Get the URI by removing the home URL
    $res = str_replace($home_url, '', $postData['flrt_ajax_link']);

    // Replace + with %2B in the result
    $res = str_replace('+', '%2B', $res);

    return $res;
    }

    // For normal request URIs, replace + with %2B as well
    return str_replace('+', '%2B', $_SERVER['REQUEST_URI']);
    }

    Best Reagards – Victor

    Thread Starter iulianmaftei

    (@iulianmaftei)

    Thank you, Victor. Just tested but no luck

    Thread Starter iulianmaftei

    (@iulianmaftei)

    Do you think there will be any official fix for this?

    Thank you

    Plugin Support fesupportteam

    (@fesupportteam)

    Hi @iulianmaftei

    We have sent this to the development team, so whenever they check it and add a fix to it will let you know here.

    Best Regards – Victor

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.