Out of Stock items not appearing in search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Out of Stock items not appearing in search results

This topic contains 10 replies, has 2 voices, and was last updated by starbellydesigns starbellydesigns 6 years, 11 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #12973
    starbellydesigns
    starbellydesigns
    Participant

    I’m having an issue where some products are not showing up in the search. My best guess at this point is that products that are out of stock are not included in the search results, would that be correct? If so, how can I have Out of Stock products appear in the results?

    The situation is all Golf Carts are marked out of stock since you cannot buy them online and we are simulating catalog mode. All of the parts & accessories are In Stock and showing in the results.

    Tom

    #12979
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Tom,

    Yes, that is actually correct. It was a planned feature, which I accidentally had left activated for this release, without implementing a switch to turn it off.

    To fix it, you will have to make a tiny change to one of the plugin files. Below I will describe exactly how to do it, but if you want, you can leave FTP access here, and I will do it for you.

    – Before you start, please make sure you have a copy of your site files, to be able to restore in case of mistakes.
    – Then open up the wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-query.php
    – Scroll to line 384, which should be this:

    if ( class_exists( 'WooCommerce' ) ) {

    – Change that to this:

    if ( class_exists( 'WooCommerce' )  && 0) {

    – Save the file, and it’s done.

    After the change, it should start working immediately.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #12991
    starbellydesigns
    starbellydesigns
    Participant

    Ernest,
    We are using v4.9.7 and are hesitant to upgrade due to customizations. That code is not in the class-asp-query.php file but I did find it in /backend/settings.php. I don’t think that’s the same thing. Is there a way to fix this issue in v4.9.7?

    Tom

    #12993
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Stock check should not affect that plugin version, but I need to check your configuration a do a few test queries to verify.

    Can you please check the back-end login details, I’m not able to log-in with them. I might also need debug the queries, but for that I need FTP access as well. If possible, can you please also add temporary FTP access as well?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #12995
    starbellydesigns
    starbellydesigns
    Participant
    You cannot access this content.
    #12996
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thanks for the SFTP, I will check that soon.

    The login I sent you was for WordPress.
    I know, but it does not work 🙂 It says that it’s an invalid username. Can you please check that?

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #12997
    starbellydesigns
    starbellydesigns
    Participant
    You cannot access this content.
    #12998
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Thank you!

    I think I found the issue, and a possible solution as well.
    The problem was not the stock status, but the price. The out of stock items had no price set, while there is a price filter in use – so they got automatically filtered from the live results.

    My solution was to create a ‘hidden’ filter on the stock status: https://i.imgur.com/M9x7oF2.png
    .. and to set the custom field logic to OR: https://i.imgur.com/1hx3V0e.png

    This means that either the price field must match, or either the item must be out of stock for it to match. I believe this should do the trick. Now when I search for an out of stock item, like ‘9009A’, it is returned as expected: https://i.imgur.com/KUnxtMd.jpg

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13044
    starbellydesigns
    starbellydesigns
    Participant

    Ernest,
    I think that’s a good start, but now if you go to this page http://dev.pacificgolfturf.com/product/e-z-go-freedom-rxv/ and try to select Product Type: Utility Vehicles and Manufacturer: Cushman, it pulls up a bunch of results that include John Deere, E-Z-GO and others. If you leave the minimum price range at $1 it even includes E-Z-GO parts that are in no way related.

    Tom

    #13051
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Tom,

    That happened, because of this one option: https://i.imgur.com/00RRB22.png
    Basically, it allowed any item that does not have any related taxonomy term attached to show up, regardless of the filter values. It’s very useful in simple filterings, but in your case it’s not. I’ve turned it off, so the filters when set, has to match strictly each one of them.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #13069
    starbellydesigns
    starbellydesigns
    Participant

    Excellent! Thanks for all the help!

    Tom

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

The topic ‘Out of Stock items not appearing in search results’ is closed to new replies.