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)
-   -   Search Results window title: more descriptive (https://forum.x-cart.com/showthread.php?t=5675)

jordan0 12-19-2003 09:29 PM

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

shan 12-20-2003 05:35 AM

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

jordan0 12-20-2003 06:20 AM

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

xcell67 05-22-2004 08:04 PM

this was posted a couple of months back, but did anyone come up ideas to use the global variables?


All times are GMT -8. The time now is 01:33 AM.

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