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.

Search on Title AND/OR Custom Field

January 26, 2008 12:39pm

Subscribe [3]
  • #1 / Jan 26, 2008 12:39pm

    I’m setting up a directory search for a client. The search criteria are:

    Company Name:
    City:
    State:
    Zip:
    Provider Type:
    Primary Contact:

    I figured I can use the weblog:entries search parameter for most of these since they are custom fields. (I’m using some php to generate the weblog:entries tag dynamically).

    However, Company Name is actually the title of the weblog entry. Since I can’t use the search parameter with title, I have no idea what to do. I’m hoping there is something obvious I’m overlooking.

    Any suggestions?

  • #2 / Jan 26, 2008 4:15pm

    tbritton

    714 posts

    Replicate the data entry - use a title field, but also a cf_company_name field. (cf_ for custom field).

    May be a way to automate that with some sql to plug the title automatically into the cf_company_name field… That way you could hide the field on the publish page but still have the data available for your search parameter. Any sql folks here?

    Terry

  • #3 / Jan 26, 2008 4:19pm

    That would work for current entries, but I’d have to re-run the SQL every time a new entry is added.

  • #4 / Jan 26, 2008 5:22pm

    tbritton

    714 posts

    That would work for current entries, but I’d have to re-run the SQL every time a new entry is added.

    Oh, yes - didn’t think of that.

    Still, the only easy solution I can think of is to not use the title field for the company name, but use a custom field for that instead. Perhaps use the title field as a heading like “Company” Data instead.

    Terry

  • #5 / Jan 27, 2008 12:30pm

    Robin Sowell

    13255 posts

    Hm- yea, I think the extra custom field is the easy way to do it.  You could create an extension that automatically duplicates the title in a custom field on publish/edit.  Otherwise- yep, manual entry is going to be the way to go.

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

ExpressionEngine News!

#eecms, #events, #releases