Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi!

    Thank you for all the information regarding the problem.

    I’ve looked at the debug data, but strangely it looks perfectly good. I even run one of the queries on my test environment and got results back, I don’t understand the problem yet.
    More strangely, when I uncheck the “product” filter on the front-end on the test URL, I get page results if I search “test a” for some reason. I honestly have no idea why is this happening, and I’m not able to recreate it either. I’m suspecting that if the product custom post type is selected, the query fails for some reason(?).

    The only thing I can do is to try guessing which part of the query, so I suggest trying these changes:

    1. On the General Options -> Sources panel, try turning off the Search all custom fields? option, and make sure no custom fields are selected: https://i.imgur.com/6gYyWQG.png

    After that, refresh the front-end and try to search again.

    2. If 1. has no effect, then on the same panel turn off the Search in terms? option: https://i.imgur.com/bxBodXw.png

    Try the search again, let’s hope that changes anything.

    If these change nothing then I might need to see the issue directly. If you can arrange temporary admin and FTP access to a test environment, please contact me via this page and refer to this topic: https://wp-dreams.com/contact/

    Thread Starter PK Webdesign

    (@pk-webdesign)

    Hi!

    Thanks for your help. Number 2 worked for me, I turned off the Search terms. That′s a pity, the two things I want to search on is title and tags, and now it′s only the title I can search on. Do you have an idea on how it should be solved?

    Now that I can see the search result I noticed that products that are out of stock shows also. Is there any option to turn that off?

    Best regards
    Peter

    Plugin Author wpdreams

    (@wpdreams)

    Hi Peter,

    I’ve spend a couple of hours investigating the terms search issue, analyzing the queries, but I have found no errors, everything works for me unfortunately. I suspect that something very specific is causing the problem, might be related to the exact environment.

    To display in stock items only, a bit of additional code is needed. Put this into the functions.php file in your active theme directory:

    add_filter( 'asl_results', 'asl_stock_status_filter', 1, 1 );
      
    function asl_stock_status_filter( $results ) {
    
      foreach ($results as $k=>$v) {
        if ( $v->content_type == "pagepost" && 
             in_array($v->post_type, array('product', 'product_variation')) 
        ) {
          // Get the stock status
          $stock_status = get_post_meta( $v->id, '_stock_status', true);
        
          if ( empty($stock_status) || $stock_status == "instock" ) 
            continue;
         
          unset($results[$k]); 
        }  
      }
      
      return $results;
    }

    This should hopefully do the trick.

    Thread Starter PK Webdesign

    (@pk-webdesign)

    Hi there!

    I think so to. I have had problems when creating the theme in Themler, problems with many things, so I think this problem is related to where I created the theme.

    The add filter did do the trick, thank you!

    Is it possible to add the tag column to General Options – Sources and basics – then into
    “..or search in selected custom fields?”?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘No results’ is closed to new replies.