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

Support archive

Multiple Channels Results Page

lincolnpixel 3 Feb 2014 13:24 question, complete

Hi Low,

Basically i have a page populated by entries from 2 channels on the same page targeting the same Results page.

{exp:low_search:form
result_page="agents/{segment_2}"
status="open|featured"
channel="for-rent|for-sale"
query="{segment_3}"
}

{exp:low_search:results
query="{segment_3}"
limit="10"
channel="for-sale|for-rent"
status="open|featured"
}

How can i limit the entries on the results page specifically to the searched channel?

Replies

  1. Low 3 Feb 2014 17:15

    Having the channel="" and status="" parameters on the Form tag has no effect.

    The Results tag you specified already limits the query to the specified channels. Do you have 2 search forms? Or do you want to choose which channel to search through? If so, just add a hidden field to each Form tag, specifying the channel, like so:

    <input type="hidden" name="channel" value="for-sale">


    ...and make sure the results tag doesn't have a channel="" param, or else that will overwrite the query.

  2. lincolnpixel 4 Feb 2014 10:05

    Hi Low,
    thanks for clarifying, i'm now able to restrict the results.

    Now, I'm interested in adding a search form on the results page (remember i'm using the same template for the results).

    How can i conditionally add the form so that it will be possible to refine the results by channel?

    Thanks

  3. Low 4 Feb 2014 10:50

    You could check the presence of the search query by using a conditional:

    {if segment_3} ...form here... {/if}


    Then you can use the query="" parameter on the Form tag to pass through the previous query, and use the remember="" parameter to remember submitted values without explicitly having input fields for them in your Form.

    Make sense?

  4. lincolnpixel 4 Feb 2014 12:55

    Hi Low,
    Using Switchee, currently i'm using a single template page for :

    i) agents list page

    ii) agent profile page (displaying entries authored by that agent and on that page i've 2 buttons linking to the results page, one for the rent listings and the other for the sales listings)

    iii) results page.

    You can check my code here .. http://pastie.org/8697651

  5. Low 4 Feb 2014 13:29

    Sorry, I'm not exactly clear where you need my help with this template... Can you try and explain?

  6. lincolnpixel 4 Feb 2014 13:40

    Hi,

    the filter form part...

    This form works for the "for-sale" channel http://pastie.org/8697783

    need to conditionally display a search form on the results page
    per channel (for-sale or for-rent) accordingly.

    Thanks

  7. Low 4 Feb 2014 13:59

    So you need to show a different form depending on the previous search? You could do that with a single form, using a conditional inside it:

    {exp:low_search:form query="{segment_3}" ... } 
    {if low_search_channel == 'for-sale'}
    ...for sale form...
    {/if}
    {if low_search_channel == 'for-rent'}
    ...for rent form...
    {/if}
    {/exp:low_search:form}

  8. lincolnpixel 4 Feb 2014 14:07

    Yessssss!

    Thanks so much Low, got it working!