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

modifying search

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-18-2002, 12:25 PM
 
ryan ryan is offline
 

Advanced Member
  
Join Date: Sep 2002
Location: Philly
Posts: 38
 

Default modifying search

I'm tring to add a few options to the searching box that is provided. I have already made it so it will search some of the params that I have added to the product table, but this only works for searches done with the provided search box. I tried adding a drop down which would be incorporated into the seach but I'm getting this error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mysite/xcart/config.php on line 293

This is how I modified the code on search.php:

Code:
$search_query = "(products.product like '%$substring%' or products.descr like '%$substring%' or products.productcode like '%$substring%' or products.param05 like '%$substring%' or products.fulldesc like '%$substring%') and categories.category like '$search_category%' and products.forsale='Y' and products.param04 = '$selGenre' group by products.product";

I added the "and products.param04 = '$selGenre' " part.
I am planning on adding an advanced search page but this was a first temp step. Any thoughts would be appriciated.

thanks
Ryan
Reply With Quote
  #2  
Old 10-21-2002, 01:30 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default

What version of x-cart are you using?
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #3  
Old 10-22-2002, 05:43 AM
 
ryan ryan is offline
 

Advanced Member
  
Join Date: Sep 2002
Location: Philly
Posts: 38
 

Default

version 3.1.3
Reply With Quote
  #4  
Old 10-23-2002, 08:26 AM
 
ryan ryan is offline
 

Advanced Member
  
Join Date: Sep 2002
Location: Philly
Posts: 38
 

Default

Well I figured out my problem and of course it was just one of those dumb mistakes. If you notice in my code above i have "products.fulldesc" but it should be "products.fulldescr". That's what you get when you change two things at once. So if anyone is interested here is how I modified the search box code (atleast the query in search.php) "selGenre" is the name of my drop down box.
Code:
if ($selGenre == 'all'){ $search_query = "(products.product like '%$substring%' or products.descr like '%$substring%' or products.productcode like '%$substring%' or products.param05 like '%$substring%' or products.fulldescr like '%$substring%') and categories.category like '$search_category%' and products.forsale='Y' group by products.product"; #echo $selGenre; } else { $search_query = "(products.product like '%$substring%' or products.descr like '%$substring%' or products.productcode like '%$substring%' or products.param05 like '%$substring%') and products.param04 like '$selGenre%' and categories.category like '$search_category%' and products.forsale='Y' group by products.product"; }

In order for the pages beyond the first page of results you also need to change this code on search.php:
Code:
$smarty->assign("navigation_script","search.php?substring=".urlencode($substring)."&in_category=$in_category&selGenre=$selGenre");
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


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 05:19 AM.

   

 
X-Cart forums © 2001-2020