Forums / General Questions / Hide category from search

Hide category from search

Views: 2,355

Results 1 to 6 of 6
15 Oct 2010, 12:29 PM
#1
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

Hide category from search

Hi,
does anyone know of a way to exclude a certain category from the search?
We have a category, which is active in menu, but that we dont want to show it in the search.
So no products within this certain category shall show up in the search in other words.

I have struggled with this for several hours now but cant figure it out.

/Jagge

16 Oct 2010, 2:40 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category from search

You can customize the file:
/includes/modules/pages/advanced_search_results/header_php.php

and change the WHERE statement:

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id ";

to exclude the category such as:

$where_str = " WHERE (p.products_status = 1
               AND p.products_id = pd.products_id
               AND pd.language_id = :languagesID
               AND p.products_id = p2c.products_id
               AND p2c.categories_id = c.categories_id 
               AND c.categories_id != '27'";

where 27 is the category to exclude ...

NOTE: you could also use in its place:
AND p.master_categories_id != '27'

depending on which works best for you ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Oct 2010, 8:40 AM
#3
jagge avatar

jagge

Zen Follower

Join Date:
Jul 2007
Posts:
110
Plugin Contributions:
0

Re: Hide category from search

Thx Ajeh!
Worked perfectly!

/Jagge

17 Oct 2010, 2:00 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Hide category from search

Thanks for the update that this worked to exclude your specified Category from the search ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Aug 2011, 12:46 AM
#5
pixelpadre avatar

pixelpadre

Suspended

Join Date:
Jun 2007
Location:
Eustis, Florida, USA, EARTH
Posts:
868
Plugin Contributions:
0

Re: Hide category from search

Ok that works for removing categories from search but can you hide the search box in certain categories?

ZC v1.5.7 "I was so much older then...I'm younger than that now" Cut the umbilical cord with webhosts after 20 years. FREEDOM!

11 Oct 2013, 5:05 AM
#6
nevtec avatar

nevtec

New Zenner

Join Date:
Oct 2007
Location:
On the edge of Bodmin Moor, Cornwall, UK
Posts:
3
Plugin Contributions:
0

Re: Hide category from search

Hi Ajeh,

We have a similar requirement.

On our website https://www.inlinefilters.co.uk I intend to put all our part number cross references in the category Brands/PartNumbers, 300000 of them.

We have two search boxes that are written in HTML in define_main_page.php. The Part Number search box uses this basic code to call up Advanced Search:

onfocus="if (this.value=='Enter any Filter Part Number here to find our Equivalent') this.value='';" onblur="if (this.value=='') this.value='Enter any Filter Part Number here to find our Equivalent';"//>
<input type="submit" name="submit" class="submit" value="Search" />
<input type="hidden" name="main_page" value="advanced_search_result" />
<input type="hidden" name="search_in_description" value="1" />

I need it configure it to just search the category Brands/PartNumbers where our cross reference data will be.

We also have two of Zen Cart's standard search boxes on the top line. Our web hosts have managed to clone the Advanced Search and hard coded it into the Part Number Finder search box to enable the required search from there (possibly not uploaded yet).

Now we require the same thing from our HTML define_main_page.php search but they are saying it is impossible to call their clone from there.

Is there a simple way to add criteria to our define_main_page.php or is a lot more programming required in or with includes/modules/pages/advanced_search_results/header_php.php where I believe all the search programming is?

Best regards,

Neville