Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

How to Exclude Disabled Categories from a Search

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-25-2005, 10:39 AM
 
mustang mustang is offline
 

eXpert
  
Join Date: Nov 2003
Location: US
Posts: 210
 

Default 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!

BTW - This is for a 4.0.12 Gold store.
__________________
X-Cart Gold 4.2.3
-----
PHP 5.2.17 | MySQL 5.1.52
Reply With Quote
  #2  
Old 04-25-2005, 10:51 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Are the products themselves disabled or just the category?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-25-2005, 11:01 AM
 
mustang mustang is offline
 

eXpert
  
Join Date: Nov 2003
Location: US
Posts: 210
 

Default

Just the category.
__________________
X-Cart Gold 4.2.3
-----
PHP 5.2.17 | MySQL 5.1.52
Reply With Quote
  #4  
Old 04-25-2005, 11:02 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Disable the products as well.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 04-25-2005, 11:12 AM
 
mustang mustang is offline
 

eXpert
  
Join Date: Nov 2003
Location: US
Posts: 210
 

Default

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?
__________________
X-Cart Gold 4.2.3
-----
PHP 5.2.17 | MySQL 5.1.52
Reply With Quote
  #6  
Old 04-25-2005, 11:42 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Hmmm...good question...and one I can't answer Shan? Boomer?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #7  
Old 04-25-2005, 06:40 PM
 
mustang mustang is offline
 

eXpert
  
Join Date: Nov 2003
Location: US
Posts: 210
 

Default

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

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'])."')"; }
__________________
X-Cart Gold 4.2.3
-----
PHP 5.2.17 | MySQL 5.1.52
Reply With Quote
  #8  
Old 07-10-2005, 11:37 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

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!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #9  
Old 07-11-2005, 03:04 AM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

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
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #10  
Old 07-11-2005, 12:56 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

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?
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:11 PM.

   

 
X-Cart forums © 2001-2020