X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How to Exclude Disabled Categories from a Search (https://forum.x-cart.com/showthread.php?t=13604)

mustang 04-25-2005 10:39 AM

How to Exclude Disabled Categories from a Search
 
I have a category that is not "Enabled" (disabled). I have products in this category that I do not want to a appear in customer search. However they do appear during a search.

So...how can I exclude any products in a disabled category from a search?

Any insight into this would be mucho appreciated! :D

BTW - This is for a 4.0.12 Gold store.

balinor 04-25-2005 10:51 AM

Are the products themselves disabled or just the category?

mustang 04-25-2005 11:01 AM

Just the category.

balinor 04-25-2005 11:02 AM

Disable the products as well.

mustang 04-25-2005 11:12 AM

I can't they are used in another area.

Basically the items in this category are only upsell accessory products. They are listed at the bottom of certain 'product detail' pages (product.php) with simply a Buy Now button. There are no details for these items so I don't want them coming up in the search. If I disable the products themselves, the won't appear as upsell items as I have them now.

HOw can exclude items from the serach function depending on category being disabled? Or if thet;s not possible...how can I exclude items based on their categiry ID? It's only one category, so I can hard code that one category into the query as an exclusion. Questions is where do I do this? :)

balinor 04-25-2005 11:42 AM

Hmmm...good question...and one I can't answer :( Shan? Boomer?

mustang 04-25-2005 06:40 PM

It think I've got this figured out. It appears to be working...at least for me it is. :D

If anyone else wants to exclude all products in disabled categories from appearing in the search results try this:

This is in XC Gold 4.0.12.

Locate the following code at around line 220 in include/search.php:
Code:

  $search_condition .= " AND $sql_tbl[products_categories].productid=$sql_tbl[products].productid AND $sql_tbl[products_categories].categoryid = $sql_tbl[categories].categoryid";
  if($current_area == 'C') {
      $search_condition .= " AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."')";
  }


And change to this:
Code:

  $search_condition .= " AND $sql_tbl[products_categories].productid=$sql_tbl[products].productid AND $sql_tbl[products_categories].categoryid = $sql_tbl[categories].categoryid";
  if($current_area == 'C') {
      $search_condition .= " AND $sql_tbl[categories].avail = 'Y' AND $sql_tbl[categories].membership IN ('','".addslashes(@$user_account['membership'])."')";
  }


balinor 07-10-2005 11:37 AM

Hey Mustang...maybe you can help me out with something since you are damn close with this little bit of code to what I want :)

I'm using Jon's hidden categories mod for a client, which you can find here:

http://forum.x-cart.com/viewtopic.php?t=11326

Works great, but the products in those hidden categories are showing up in the search results. I tried your code above, but that is also hiding the products from displaying in the hidden category. Any ideas? Thanks in advance!

shan 07-11-2005 03:04 AM

if a category is set to disabled or hidden then products in that category should not show up anywhere and so this sounds like a bug.

If you can confirm that this is happening on a non modified cart then we should move this to bugs forum

balinor 07-11-2005 12:56 PM

Just tested this out in a fresh install of X-Cart and the same thing is happening. Using Jon's hidden categories mod, the products in the hidden categories are showing up in the search results. Mustang's mod above fixes the search results problem, but also ends up hiding the products in the hidden category as well :( Ideas anyone?


All times are GMT -8. The time now is 11:35 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.