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

Search Results window title: more descriptive

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-19-2003, 09:29 PM
 
jordan0 jordan0 is offline
 

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

Default Search Results window title: more descriptive

Hi,
I have gotten x-cart to pass the in_category part of the seach query into a global variable that I have used to do other things on my site (like making mod sort work the way i want it to). I want to use it now to make the title of the search results more informative so when I use hard-coded search links they appear to function a bit nicer. If anyone wants instructions on passing search query bits into global variables I will share the process Б─⌠ it is very simple.
So now that I have this variable that contains a category ID, what do i use to display the name of that category id?
i tried
Code:
$categories[$stay_in_category].category
($stay_in_category is the name of this global variable that contains the category id)
but that just gives me this
Code:
Array[12].category

I know this is simple, please help
thanks
-Jordan
__________________
Jordan Sitkin
http://www.kitkraft.biz
X-Cart 4.0.18 [unix]
Reply With Quote
  #2  
Old 12-20-2003, 05:35 AM
  shan's Avatar 
shan shan is offline
 

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

Default

Code:
If anyone wants instructions on passing search query bits into global variables I will share the process Б─⌠ it is very simple.

you may as well just post your findings as theres always someone who will find it helpful
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #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
  #4  
Old 05-22-2004, 08:04 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

this was posted a couple of months back, but did anyone come up ideas to use the global variables?
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 02:44 PM.

   

 
X-Cart forums © 2001-2020