X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   modifying search (https://forum.x-cart.com/showthread.php?t=344)

ryan 10-18-2002 12:25 PM

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

B00MER 10-21-2002 01:30 PM

What version of x-cart are you using?

ryan 10-22-2002 05:43 AM

version 3.1.3

ryan 10-23-2002 08:26 AM

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");


All times are GMT -8. The time now is 05:16 PM.

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