ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Location ID search

April 29, 2011 1:44pm

Subscribe [2]
  • #1 / Apr 29, 2011 1:44pm

    dgraydesign

    30 posts

    I’m trying to figure out the best way to handle this need on my client’s site: I have a Channel for Exhibitors in which there’s a filed called “Booth Location.” This field is an ID number. I want to set up an input where a visitor can enter a booth ID# and it takes them to that Exhibitor’s page. I don’t want a search results page - I want it to go directly to the exhibitor’s info page (generated from the ‘Exhibitors’ channel) Any suggestions on how to set this up in EE?

  • #2 / Apr 29, 2011 7:27pm

    the3mus1can

    426 posts

    Try something along these lines (you will probably have to change a lot of the names, but it is a starting place):

    field_name_for_booth_id is whatever you have named the field in the channel that holds the booth’s ID #.

    Search form:

    <form action="{path="exhibitor"}" method="post">
        
            <label for="booth_id">Booth ID#</label>
            <input type="text" name="search:field_name_for_booth_id" value="" id="booth_id" />
        
        <input type="submit" value="Lookup" /></p>
    </form>

    Template (exhibitor/index)

    {exp:channel:entries 
        disable="categories|category_fields|member_data|pagination|trackbacks" 
         dynamic_parameters="search:field_name_for_booth_id"
        limit="1" 
        require_entry="yes"
    }
    
    {if no_results}{redirect="404"}{/if}
    
    ... other template code ....
        
    {/exp:channel:entries}


    This uses dynamic parameters and here are the docs for them: http://ellislab.com/expressionengine/user-guide/modules/channel/dynamic_parameters.html

  • #3 / Apr 29, 2011 7:39pm

    dgraydesign

    30 posts

    Yes! I had forgotten about being able to limit the search to one custom field. I think this should work well. Thanks!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases