Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Excluding a specific category from search?


DVDtrix

Recommended Posts

I have a category for Adults, which has sub categories, and it is 'protected' by the age check contrib. It works great now, but, and its a big but... when I do a search for XYZ it returns products in the adult category and then you can bypass the check by simply using the buy now button.

 

Can I exclude a category from my search?

Link to comment
Share on other sites

One way of doing that is to modify the file advanced_search_result.php.

There's a sql query that could be modified to exclude certain categories.

 

However, I never used the contribution that you mentioned so I don't know the "correct" way of doing what you want. How would a "certified" 18+ customer find the products targeted for them if selected categories are hidden?

 

HTH,

Robert

Link to comment
Share on other sites

Targets arent hidden - can you do that? I simply installed the agepage contrib from this site. When you click on the Adult category (12) it throws the message and off you go... but I really dont want search to return results as I dont want to offend customers who dont wish to know about the adult stuff.

 

I wonder if I could edit the search page and use hidden fields to hard code the categories it searches on? I could manually add all but adult.

Link to comment
Share on other sites

...

I wonder if I could edit the search page and use hidden fields to hard code the categories it searches on? I could manually add all but adult.

I believe that I suggested that earlier in the thread.

 

In my opinion, it would be easier to exclude some categories than include most.

 

HTH,

Robert

Link to comment
Share on other sites

Patience is a virtue.

Here's a quick and dirty way to do it:

 

Open the file catalog/advanced_search_result.php and search for

$where_str = " where p.products_status = '1'

 

Right under that line enter the following:

$where_str .= " and c.categories_id not in ('12','13','14')";

 

Simply replace the values with your adult category IDs.

The code above is untested but it should be ok, so let me know if it works.

 

HTH,

Robert

Link to comment
Share on other sites

Patience is a virtue.

Here's a quick and dirty way to do it:

 

Open the file catalog/advanced_search_result.php and search for

$where_str = " where p.products_status = '1'

 

Right under that line enter the following:

$where_str .= " and c.categories_id not in ('12','13','14')";

 

Simply replace the values with your adult category IDs.

The code above is untested but it should be ok, so let me know if it works.

 

HTH,

Robert

It is indeed ;)

Thanks, I had been trying to go through the search page and add in a hidden categories_id field but you could only send it one value.

I have looked in my advance_search_results.php and the line above doesnt appear!

Link to comment
Share on other sites

I'm a bit confused.

My solution does not require adding any "hidden" fields.

 

If you are looking at the file called advanced_search_result.php send me a PM with the contents of that file and I'll look at it.

 

Robert

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...