[ic] newbie needs help displaying variable

Kevin Walsh interchange-users@icdevgroup.org
Fri Aug 9 16:21:02 2002


> 
> 	i was helped just yesterday by somebody to get interchange to print the 
> mv_searchspec value on the results.html page (im just customizing the 
> foundation store), and now i need help getting it to print the 
> mv_search_field and mv_search_file variables as well. is there a kind, wise 
> soul out there who could help me? or am i doomed to wander aimlessly forever?
> 
The search specification can be found in [data session last_search].

The following should give you a space-separated list of search fields:

    [calc]
        my @fields;
        foreach (split('/',$Session->{last_search})){
            /^(.+?)\s*=\s*(.+)$/;
            next unless $1 eq 'sf';
            push(@fields,$2);
        }
        join(' ',@fields);
    [/calc]

You can adapt that to extract any information you need; The following
should just dump the whole search parameter list:

    [calc]
        my $buf = '';
        foreach (split('/',$Session->{last_search})){
            /^(.+?)\s*=\s*(.+)$/;
            my ($name,$val) = ($1,$2);
            $val =~ s/%(.{2})/chr(hex($1))/ge;
            $buf .= qq{$name = "$val"<br>};
        }
        $buf;
    [/calc]

Remember that the "search file" will default to "products", or whatever
you have in your ProductFiles directive (catalog.cfg), if not specified
in the search parameters.

-- 
   _/   _/  _/_/_/_/  _/    _/  _/_/_/  _/    _/
  _/_/_/   _/_/      _/    _/    _/    _/_/  _/   K e v i n   W a l s h
 _/ _/    _/          _/ _/     _/    _/  _/_/    kevin@cursor.biz
_/   _/  _/_/_/_/      _/    _/_/_/  _/    _/