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 6 years, 11 months ago.
- AuthorPosts
- May 4, 2017 at 6:18 pm #12973
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
May 5, 2017 at 2:19 pm #12979Hi 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 :)
May 5, 2017 at 6:11 pm #12991Ernest,
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
May 5, 2017 at 6:17 pm #12993Stock 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 :)
May 5, 2017 at 6:25 pm #12995You cannot access this content.May 5, 2017 at 6:27 pm #12996Thanks for the SFTP, I will check that soon.
The login I sent you was for WordPress.
Best,
I know, but it does not work 🙂 It says that it’s an invalid username. Can you please check that?
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
May 5, 2017 at 6:29 pm #12997You cannot access this content.May 5, 2017 at 6:57 pm #12998Thank 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.pngThis 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 :)
May 10, 2017 at 9:08 pm #13044Ernest,
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
May 11, 2017 at 10:44 am #13051Hi Tom,
That happened, because of this one option: https://i.imgur.com/00RRB22.png
Best,
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.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
May 11, 2017 at 5:40 pm #13069Excellent! Thanks for all the help!
Tom
- AuthorPosts
The topic ‘Out of Stock items not appearing in search results’ is closed to new replies.