View Single Post
  #3  
Old 12-20-2003, 06:20 AM
 
jordan0 jordan0 is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: San Francisco, CA
Posts: 77
 

Default Here is what I did:

My process for passing search query info into global variables:
If you want to do this, you must first perform the "Improved Search Function" mod: http://forum.x-cart.com/viewtopic.php?t=5971

In my /include/func.php, I found this portion:

Code:
# # Search for products in products database # function func_search_products($query, $membership,$first=0,$count_all=-1,$get_all=0, $orderby="orderby", $mod_sort="", $mod_sort_field="") { global $current_area; global $store_language, $sql_tbl; global $config;
And added this line right after it
Code:
global $stay_in_category, $stay_in_param01, $stay_in_param02, $stay_in_param03;
Then, at every place in the customer/search.php where the above chunks of the query are handled, I added lines like
Code:
$smarty->assign("stay_in_param01","$search_param_01");
So, for example, one of my "Search Query Chunks" now looks like this:
Code:
#Param02 Search $conq = ""; $andq = "AND"; if(!empty($search_param_02)){ $smarty->assign("stay_in_param02","$search_param_02"); $ssq = split(" ",$search_param_02); foreach($ssq as $sq) $conq[] = "(".$sql_tbl[products].".param02 like '%".$sq."%'"." OR ". $sql_tbl[products].".param02 like '%".$sq."%'".")"; } if(empty($andq))$andq = "OR"; $param02_query = (!empty($conq)) ? " AND (".join(" ".$andq." ",$conq).") " :"";

Now, I can have Boomer's CartLab Mod Sort take the current category and use it to sort the search results instead of the pull-down menu... and keep it from "forgetting" the param part of the search...

Or I can display the category name instead of "Search Results" in the location header and the dialog title when the search is confined to one category. I just have to know how to turn this $stay_in_category value (a categoryid) into a category name.

You can probably find plenty of uses for the global variables, and I bet a few of them would involve turning this value into a name. If you know how, please share.

Thanks
Jordan
__________________
Jordan Sitkin
http://www.kitkraft.biz
X-Cart 4.0.18 [unix]
Reply With Quote