All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Stumped

Richard 2 Nov 2012 19:20 question, complete

Usage seemed straightforward enough, but I'm failing to understand how to use Low Search. Here's my search form. The first search field, a Playa field, works perfectly; I get the expected results. The second field, artwork_sales_type, a dropdown field (didn't work as a radio field either) doesn't do anything. The selected item doesn't stay selected (after clicking Search the drop-down menu reverts to Any, not staying, say, Print Shop) and the search results aren't altered. The artwork_sales_type is set to searchable.

{exp:low_search:form query="{segment_3}" result_page="mss/sales"}

Artist

Any
{exp:channel:entries channel="artist"}
{exp:strip_line_breaks}{exp:tagstripper:stripAllTags}{artist_info}{last}, {given}{/artist_info}{/exp:tagstripper:stripAllTags}{/exp:strip_line_breaks}
{/exp:channel:entries}

Sales Type

Any
Commission
Consignment
Print Shop

 

Search

{/exp:low_search:form}

Here's the results part:

{exp:low_search:results query="{segment_3}"}
{exp:ce_img:pair src="{artwork_gallery}{image}{/artwork_gallery}" width="150" height="120" crop="yes"}

{/exp:ce_img:pair}
{if no_results}No search results{/if}
{/exp:low_search:results}

I must be misunderstanding something pretty fundamental.

Replies

  1. Richard 2 Nov 2012 19:23

    Ack! Sorry. The code I pasted into my post rendered in an unexpected useless way (obviously). I'll try to correct it later. I have to run right now. Again, sorry about that.

  2. Richard 2 Nov 2012 19:25

    Here's the code before I run off for a bit (hope it shows up properly):

      
    {exp:low_search:form query="{segment_3}" result_page="mss/sales"}
    <fieldset>
    <label for="child:artwork_artist">Artist</label>
    <select name="child:artwork_artist">
    <option value="">Any</option>
    {exp:channel:entries channel="artist"}
    <option value="{entry_id}" {if entry_id IN ({low_search_child:artwork_artist})} selected="selected"{/if}>{exp:strip_line_breaks}{exp:tagstripper:stripAllTags}{artist_info}{last}, {given}{/artist_info}{/exp:tagstripper:stripAllTags}{/exp:strip_line_breaks}</option>
    {/exp:channel:entries}
    </select>
    <label style="margin-left:20px" for="artwork_sales_type">Sales Type</label>
    <select name="artwork_sales_type">
    <option value="">Any</option>
    <option value="Commission" {if artwork_sales_type == 'Commission'} selected="selected"{/if}>Commission</option>
    <option value="Consignment" {if artwork_sales_type == 'Consignment'} selected="selected"{/if}>Consignment</option>
    <option value="Printshop" {if artwork_sales_type == 'Printshop'} selected="selected"{/if}>Print Shop</option>
    </select>
    <p>&nbsp;</p>
    <button type="submit">Search</button>
    </fieldset>
    {/exp:low_search:form}

    {exp:low_search:results query="{segment_3}"}
    {exp:ce_img:pair src="{artwork_gallery}{image}{/artwork_gallery}" width="150" height="120" crop="yes"}
    <img src="{made}" alt="" width="{width}" height="{height}" >
    {/exp:ce_img:pair}
    {if no_results}No search results{/if}
    {/exp:low_search:results}
    </pre>

  3. Low 2 Nov 2012 19:41

    Sinds you aren't using a keyword search, but you're targeting a specific field, do what you'd do in a native channel:entries tag: use the search:field="" parameter.

    To use that in the Low Search form, simply use the input/select name="search:field".

    So, in your case:

    <select name="search:artwork_sales_type">


    As values, use anything you'd use in the channel:entries tag parameter. You can use {low_search_search:artwork_sales_type} in conditionals to remember the selection.

    Low 2 Nov 2012 19:43

    ^since, obviously. Typing on an iPad with Dutch autocorrect. :)

  4. Richard 2 Nov 2012 20:42

    Yowza! That worked! Thanks for the very fast reply.