Post by sicotommo » Fri Jul 08, 2016 10:18 pm

HI

I have a store with some active products we use in a "product builder" - these products are only used in the product builder because of the manner in which it works and the nature of the products and aren't linked to any category. However if someone searches for a product it will probably show up in the search and we have just had some people buy the product. How do we hide the product from search results if they aren't already linked to a category? Any modules that will do that?

Thanks for any tips.
Simon

New member

Posts

Joined
Wed Jul 27, 2011 8:55 am

Post by Johnathan » Fri Jul 08, 2016 11:07 pm

Smart Search can do this. You can enter the product_id's of products to hide, and they will then not show up in the search results. It also includes a bunch of other features you might find useful, as well.

If you want to hard-code that kind of restriction yourself, you could try an edit like this, which should skip the product_id's you specify:

Code: Select all

IN:
/catalog/controller/product/search.php

AFTER:
foreach ($results as $result) {

ADD:
if ($result['product_id'] == 10) continue;
if ($result['product_id'] == 22) continue;
if ($result['product_id'] == 35) continue;
etc. 
You can add as many of those "if" statements as you need.

Note that if you do that, the search results count will still be off, because that's controlled by a separate database query. It's unlikely a customer would really notice or care about that, though, unless you're hiding a ton of products.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: Baidu [Spider], Semrush [Bot] and 105 guests