[ic] scratch variables in search conditions (Was: How can I override ProductFiles?)

Cameron B. Prince cameron@akopia.com
Mon, 30 Oct 2000 13:49:03 -0600


Hi Doug,

I believe you will need to use a search profile to accomplish this. Scratch
calls aren't interpolated within the search string. We have something
similar on a site that allows customers to define or narrow results in a
search:

On index.html: (Sets the default match limit to 5)

[if !scratch sprofile][set sprofile]ml=5[/set][/if]


Then in the complex search for the areas: (Tells each link to use the proper
search profile)

fi=products
st=db
co=yes
sf=category
se=Chargers
mp=sprofile
sp=results_image


Then finally on the results page, we have this code that sets some search
options and refreshes the results page.

[search-region]

<!-- FOLLOWING CODE MUST BE INSIDE THE SEARCH REGION -->

[value name=mv_matchlimit set=`$Search->{''}{mv_matchlimit}` hide=1]

[seti sprofile]
ml=[value name=mv_matchlimit set=`$Search->{''}{mv_matchlimit}`]
sp=[value name=mv_search_page set=`$Search->{''}{mv_search_page}`]
[/seti]

<FORM ACTION="[area search]">
                              <tr>
							  <td align="center">
<SELECT NAME="mv_matchlimit">
[loop list="2 5 10 15 25 50 100" option=mv_matchlimit]
<option value="[loop-code]">[loop-code]
[/loop]
</select>

							  </td>
							  <td align="center">
<SELECT NAME="mv_search_page">
<option value="results_image">With Image
<option value="results" [selected mv_search_page results]>Condensed
</select>
</td>
							  <td align="center">
<INPUT TYPE=hidden NAME=mv_coordinate VALUE=1>
<INPUT TYPE=hidden NAME=mv_searchspec VALUE="[value name=tmp_option
set='[value-extended name=mv_searchspec index=0]']">
[loop search='st=db
              fi=products
              sf=category
	      se=[value-extended name=mv_searchspec index=0]
              rf=manufacturer
	      un=true
              '
	  prefix=manf
	  option=tmp_option
]

<SELECT NAME="mv_searchspec">
<option value="">Display All
[list]
<option value="[manf-code]">[manf-code]
[/list]
[/loop]
                              </select>

</td>
							  <td align="center">
							  <input type="image" src="__IMAGE_DIR__/navigation/refresh2.gif"
value="Refresh" border="0">
							  </td>
							  </tr>
</FORM>


Thanks go to Mike Heins for his help on this code...

Hopefully this will get you going in the right direction.

Good luck,

Cameron




-----Original Message-----
From: interchange-users-admin@minivend.com
[mailto:interchange-users-admin@minivend.com]On Behalf Of Doug Alcorn
Sent: Thursday, October 26, 2000 1:30 PM
To: interchange-users@minivend.com
Subject: [ic] scratch variables in search conditions (Was: How can I
override ProductFiles?)


"Cameron B. Prince" <cameron@akopia.com> writes:

> Use the admin UI and go to the Design tab.
>
> Select the area/category and change the link-type to complex search.
>
> You'll need something like:
>
> fi=products
> st=db
> co=yes
> sf=category
> se=Chargers
> ml=10
>

Thanks for taking the time to point out something so easy.  I have
been doing most of my page design stuff from the text editor rather
than the UI.

I tried the above and it worked great (of course).  I used this complex
search:
   fi=products/st=db/sf=category/se=batteries/sf=addl_category/se=MOTNEXI600

This returned the limited search I was expecting.  Now the twist is
that I want the search equal for addl_category to be a scratch
variable.  Something like this:

fi=products
st=db
sf=category
se=batteries
sf=addl_category
se=[scratch addl_category]

This doesn't work because it actually tries to find an addl_category
that matches the literal '[scratch addl_category]'.

The documentation says that the variable mv_last stops interpretation
of search variables.  Does this relate to what I'm trying to do?
--
 (__)  Doug Alcorn (mailto:doug@lathi.net http://www.lathi.net)
 oo /  Unix Hacker
 |_/   "It's too late for paradise"

_______________________________________________
Interchange-users mailing list
Interchange-users@www.minivend.com
http://www.minivend.com/mailman/listinfo/interchange-users