[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Difficulty understanding interpolation
****** message to minivend-users from Frank Miedreich <miedreich@acm.org> ******
>****** message to minivend-users from Chris Powell
><helios@brickandivy.com> ******
>
>I'm afraid I've run into what is probably a fairly simple problem to
>solve -- I'm relatively new to Minivend, thus still learning my way.
>
>Let's say my user searches for a certain manufacturer. On my
>results.html page I want it to say something like:
>
> We carry a full line of Kelty products!
>
>which I accomplish via:
>
> We carry a full line of [value mv_searchspec] products!
>
>The problem is, if there the user follows a [more] tag link,
>mv_searchspec gets nulled. I've tried to get mv_searchspec set into a
>non-volatile scratch variable on the first results page by doing this:
>
>[set mv_put_session]Yes[/set]
>[set company]
>[value mv_searchspec]
>[/set]
>
>but that is not working due to, I believe, the order things get
>interpolated. That is, my variable 'company' actually gets set to the
>string "[value mv_searchspec]" ...
>
>Is there a straightforward way to pull mv_* vars into my scratch space
>for preservation?
>
>Thanks for the help,
>Chris Powell
Hello,
I do not know about straightforward, but here is what I do:
I collect the info what is searched for on the search page, not on the
results page. This can easily done by setting mv_check in the search form:
---------------------------------------------------------------------------
[set search values]
[perl arg=values interpolate=1]
my($msg)='[value mv_searchspec]';
my($price)='[value mv_range_max]';
my(@items)=split (/\0/, $msg);
$Safe{'values'}{'search_category'} = $items[0];
$Safe{'values'}{'search_sub_category'} = $items[1];
$Safe{'values'}{'search_price'} = $price?"up to $price":'no limit';
return '';
[/perl]
[/set]
<INPUT TYPE="hidden" NAME="mv_check" VALUE="search values">
---------------------------------------------------------------------------
It is not necessary to use perl of course, and you could put the vars into
scratch space if you like. This example also shows how to split
mv_searchspec if you use minivend's variable stacking feature.
On the page where I use this code people search for products from a certain
category and subcategory, but can limit the maximum price of the results.
Cheers, Frank
--
Frank Miedreich
Max-Planck-Institut fuer psychologische Forschung
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list