Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12664

    Hey i have a Relevanssi plugin filter in my function.php

    add_filter(‘relevanssi_hits_filter’, ‘separate_result_types’);

    function separate_result_types($hits) {

    $types = array();

    $no_of_products=3 ;

    $no_in_array=0 ;

    $no_of_blog_in_array=0;

    $product_array=array(3409,3387,3395);

    $compare_array = array();

    // Split the post types in array $types

    if (!empty($hits)) {

    foreach ($hits[0] as $hit) {

    if (!is_array($types[$hit->post_type])) $types[$hit->post_type] = array();

    if($hit->post_type==’product’)

    {

    if($no_in_array!=$no_of_products)

    {

    array_push($types[$hit->post_type], $hit);

    $no_in_array=$no_in_array+1;

    if(in_array($hit->ID,$product_array))

    $arr=array_push($compare_array,$hit->ID);

    }

    }

    else if ($hit->post_type==’post’ && $no_of_blog_in_array<3)

    {

    array_push($types[$hit->post_type], $hit);

    $no_of_blog_in_array++;

    }

    // array_push($types[$hit->post_type], $hit);

    }

    }

    This works great on search page , but my product search now always shows me NO match found . But when i remove the filter it can find the product , is there someway possible that i can just add the filter to the search form on header and not on product widget .

    do they use different templates or anything ??

    #76303

    Hi!

    Did you try to contact the plugin author: http://www.relevanssi.com/support/ ? To be honest I’m not familiar with the Relevanssi API/hooks/filters.

    Best regards,

    Peter

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Relvenassi Plugin and woocommerce product search widget not working’ is closed to new replies.