• Resolved wood1e

    (@wood1e)


    Hi

    We are using Product Table to display the products in a two column format, just

    SKU and
    Product Name

    But on the above mentions page when I search for example “motor’ and then click ‘View All’ or hit return, the results are not relevant? See here: https://app.screencast.com/ou7ZJQfYIHWUT amd here https://app.screencast.com/O05jm3PceU397 it should be 117 not all the products.

    Is there soemthing I have done, or maybe the WP product Tables doesn’t work with FiboSearch?

    • This topic was modified 2 months, 1 week ago by wood1e.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Kris

    (@c0nst)

    Hi?@wood1e!

    This support forum is only for users of the Free version of FiboSearch.
    Because you’re asking about the Pro version, please submit a ticket again via our website: https://fibosearch.com/contact/.

    Regards,
    Kris

    Thread Starter wood1e

    (@wood1e)

    Sorry I was testing using my Pro license, now back on Free version.

    Regards

    Rob

    Thread Starter wood1e

    (@wood1e)

    sorry I should have messaged mentioned that the free version is the plugin we want to use.

    i just tested with my pro version briefly just in case it was a functionality issues

    So i think we are doing something wrong?

    Thread Starter wood1e

    (@wood1e)

    @c0nst – any ideas what could be going wrong?

    Plugin Support Kris

    (@c0nst)

    Hi @wood1e!

    With the below code snippet you should be able to display the correct search results in your plugin:

    use \DgoraWcas\Helpers;

    add_filter( 'wcpt_query_args', function ( $query_args ) {
    if ( ! isset( $_GET['dgwt_wcas'] ) ) {
    return $query_args;
    }

    $search_terms = get_search_query();
    $products_ids = [];

    if ( ! dgoraAsfwFs()->is_premium() ) {
    $products_ids = Helpers::searchProducts( $search_terms );
    } elseif ( dgoraAsfwFs()->is__premium_only() ) {
    $products_ids = Helpers::searchProducts__premium_only( $search_terms );
    }

    if ( empty( $products_ids ) ) {
    $query_args['post__in'] = [ 0 ];
    return $query_args;
    }

    if ( empty( $query_args['post__in'] ) ) {
    $post_ids = $products_ids;
    } else {
    $post_ids = array_intersect( $query_args['post__in'], $products_ids );
    }

    $query_args['post__in'] = empty( $post_ids ) ? [ 0 ] : $post_ids;

    $query_args['orderby'] = 'post__in';

    // Remove unnecessary query arguments to prevent overrides
    unset( $query_args['meta_key'], $query_args['order'], $query_args['meta_query'] );

    return $query_args;
    } );

    You have two ways to add this code to your theme:

    1. Open the?functions.php?in your child theme and add the code at the end.
    2. ?or install the?Code Snippets?plugin and apply this code as a snippet.

    Also, please make sure that you set the “Initial orderby” option to Product ID (screenshot).

    Regards,
    Kris

    Thread Starter wood1e

    (@wood1e)

    hi
    many thanks I am getting this error: https://app.screencast.com/bnIjFTIf1Ds7H

    We need the initial sort order to be based on SKU? Would that not be possible now?

    Thread Starter wood1e

    (@wood1e)

    Apologises, I have an update, we are getting slightly wrong results.

    For example I search ‘COVER” and I get the correct results, but then from result page I search “MOTOR” and ‘view all is 117’ but the results are still for ‘COVER’
    see here: video.mp4

    • This reply was modified 2 months ago by wood1e.
    Plugin Support Kris

    (@c0nst)

    Hi @wood1e!

    This error in the code could be due to an invisible character somewhere in line 62. Sometimes this can happen when copying and pasting code. The best way to check this is to paste it into an editor such as Visual Code or Notepad++.

    Of course, you can sort these results by SKU, but then the order will not match the order of products in FiboSearch autocomplete.

    Please make sure that the shortcode from the Product Table placed in the search results doesn’t have any categories selected. This setting may overwrite the FiboSearch results (screenshot).

    Regards,
    Kris

    Thread Starter wood1e

    (@wood1e)

    Hi

    Thanks for that, I was able to place the coding in the functions.php file, but it doesn’t seem to have solved the problem. I am not even sure what the coding is for?

    video above

    When I search I get the correct results, but when I search using a different term I ge thte previous results

    So if you search ‘motor’ you get 117 results and they displya correctly when I click on VIEW ALL. But from that results page enter ‘Cover’ there is 78 results, I click “View All’ and I get the same 117 results I got with Motor.

    Basically the search function seems to get stuck, now even without a search item in the field only ‘Motor’ results are showing, even after clearing cache on server and browser.

    not sure what is going on.

    Thread Starter wood1e

    (@wood1e)

    We have bought license so this post can be closed

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