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.

Need Add-on(s) for Custom Search

November 04, 2011 11:54am

Subscribe [2]
  • #1 / Nov 04, 2011 11:54am

    Envision

    18 posts

    Hi,

    We have a site with a list of companies in channel entries. We need to modify the basic EE search experience so that a user can not only search for a company by keyword, but by keyword and state. The state would be a dropdown/select field next to the text field. The companies’ state data is a listed in a very specific field in the channel entry. The search results must only show companies that match the keyword and the indicated state. If no state is selected, matches from all states must show.

    We would also need a different search where a user selects 2 options in 2 different dropdowns/selects. 1 dropdown would be searching data from a custom field (state) and the other would search channel entries for a category name. So the search results would show only entries that match both that state and category.

    Are there any add-ons that would allow us to do this? Super Search? Search Fields? Or does this need to be custom-developed?

    Thanks!

  • #2 / Nov 04, 2011 12:13pm

    Darren Miller

    103 posts

    Super Search might do it for you, as might a complex URL structure and some in-template PHP. However, your requirement is so specific that I think you’d benefit from a custom add-on.

    If you’re up for doing that yourself you’ll need some SQL knowledge, a familarity with exp_channel_titles and exp_channel_data and a plugin to extend the Channel module.

    I wrote a little helper on doing the latter recently which contains a lot of what you’d need.

    First you will need to establish the query to run to get back entry_ids for each entry that matches your search. Most of your work lies there. Then get all these ID’s into a pipe separated string and pass this to the Channel module from your add-on like so:

    $this->EE->TMPL->tagparams['entry_id'] = '1|345|878|25|101';

    Your template tag can then run as per a normal channel:entries loop.

    It might sound like a hassle but it’s actually quite an efficient way to filter entries and reflects what the Channel module itself does when you start passing lots of parameters

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

ExpressionEngine News!

#eecms, #events, #releases