[L3.6 Question] - Using search parameters

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[L3.6 Question] - Using search parameters

Doug Noble
Lasso 3.6 question - I want to be able to tell people to search for
"specials" on the website and have the specials displayed with sale prices
in a special format.

I have a simple search box on my home page which goes to a search results
page. It is searching a keyword field that has concatenated text from
several fields - category, title, description.

<form method="POST" action="action.lasso" name="searchform">
<input type="text" name="keyword" value="" size="8" maxlength="25">

  <input type="hidden" name=-DB value="blah.fm5">
              <input type="hidden" name=-LAY value="web">
              <input type="hidden" name="-format" value="results2a.html">
           <input type="submit" name="-search" value="Go">
             </form>


What I want to do on the results page if the search term is "specials" is
display one chunk of code, and if the search term is anything else, display
the other chunk.

[IF:  word searched for is specials]

[include: normal price format code] [else:] [include sale price format code]
[/IF]

Is there a way to use [Search_Arguments]  [SearchValueItem]
[/Search_Arguments]  in an IF statement?


Doug Noble
[hidden email]



--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: [L3.6 Question] - Using search parameters

Douglas Burchard
On Jul 19, 2005, at 5:51 PM, Doug Noble wrote:

> <form method="POST" action="action.lasso" name="searchform">
> <input type="text" name="keyword" value="" size="8" maxlength="25">
>
>   <input type="hidden" name=-DB value="blah.fm5">
>               <input type="hidden" name=-LAY value="web">
>               <input type="hidden" name="-format"  
> value="results2a.html">
>            <input type="submit" name="-search" value="Go">
>              </form>
>
>
> What I want to do on the results page if the search term is  
> "specials" is
> display one chunk of code, and if the search term is anything else,  
> display
> the other chunk.
>
> [IF:  word searched for is specials]
>
> [include: normal price format code] [else:] [include sale price  
> format code]
> [/IF]
>
> Is there a way to use [Search_Arguments]  [SearchValueItem]
> [/Search_Arguments]  in an IF statement?

How about [If: (Form_Param: 'keyword') == 'specials'] ... [Else] ...  
[/If].


--
Douglas Burchard, President
DouglasBurchard.com, Web Applications
15024 NE 66th Street
Redmond, WA  98052, USA

direct: (206) 227-8161
[hidden email]
http://www.douglasburchard.com/


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: [L3.6 Question] - Using search parameters

Wade Maxfield
In reply to this post by Doug Noble
>Lasso 3.6 question - I want to be able to tell people to search for
>"specials" on the website and have the specials displayed with sale prices
>in a special format.
>
>I have a simple search box on my home page which goes to a search results
>page. It is searching a keyword field that has concatenated text from
>several fields - category, title, description.
>
><form method="POST" action="action.lasso" name="searchform">
><input type="text" name="keyword" value="" size="8" maxlength="25">
>
>   <input type="hidden" name=-DB value="blah.fm5">
>               <input type="hidden" name=-LAY value="web">
>               <input type="hidden" name="-format" value="results2a.html">
>            <input type="submit" name="-search" value="Go">
>              </form>
>
>
>What I want to do on the results page if the search term is "specials" is
>display one chunk of code, and if the search term is anything else, display
>the other chunk.
>
>[IF:  word searched for is specials]
>
>[include: normal price format code] [else:] [include sale price format code]
>[/IF]
>
>Is there a way to use [Search_Arguments]  [SearchValueItem]
>[/Search_Arguments]  in an IF statement?
>
>
>Doug Noble
>[hidden email]

I've got something similar on an old site.  Set a variable with the
search term, then use that to determine which price stuff to show.



At the top of the results page

[Variable_Set: 'keyword'=(form_param: 'keyword',raw)]
[if: (Variable: 'keyword')=='specials']
   [Variable_Set: 'showPrice'='specials']
[else]
   [Variable_Set: 'showPrice'='normal']
[/if]

Then inside your inline

[if: (Variable: 'showPrice')=='specials']
   [Records]
      display item with special price field
   [/Records]
[else]
   [Records]
       display item with normal price field
   [/Records]
[/if]


You could do also it this way (but it would be slower as you are
doing a comparison for each record found)

[Records]
   [if: (Variable: 'showPrice')=='specials']
      display special price
   [else]
      display normal price
   [/if]
[Records]


You could also do a little bit of processing of the search term, say
check if it contains specials, rather than is exactly specials.
Depends on how strict you want to be with your visitors.

  -Wade

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: [L3.6 Question] - Using search parameters

Doug Gentry
In reply to this post by Doug Noble
Or to build on this

[If: (Form_Param: 'keyword') >> 'specials'] ... [Else] ... [/If]  
using contains rather than equals, in case the user slipped a space in
or another word.

And run, don't walk to inlines. Lasso 3.6 can support them just fine.
While you're mucking around with this page, put the database and layout
information on the response page in an inline, rather than in hidden
form_params.

...Doug Gentry


On Jul 19, 2005, at 6:09 PM, Douglas Burchard wrote:

> On Jul 19, 2005, at 5:51 PM, Doug Noble wrote:
>
>>              </form>
>>
>>
>> What I want to do on the results page if the search term is
>> "specials" is
>> display one chunk of code, and if the search term is anything else,
>> display
>> the other chunk.
>>
>
> How about [If: (Form_Param: 'keyword') == 'specials'] ... [Else] ...
> [/If].
>
>
> --
> Douglas Burchard, President
> DouglasBurchard.com, Web Applications
> 15024 NE 66th Street
> Redmond, WA  98052, USA
>
> direct: (206) 227-8161
> [hidden email]
> http://www.douglasburchard.com/
>
>
> --
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:
> http://www.listsearch.com/lassotalk.lasso?manage
>

---
Doug Gentry
Dynapolis & Southern Oregon University
p:  541-261-8501 / Toll Free: 888-490-0644
[hidden email]


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage