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 Module question

January 04, 2012 7:05am

Subscribe [3]
  • #1 / Jan 04, 2012 7:05am

    Duffy-D

    5 posts

    Hi all,

    I’m just finishing a website for one of my clients and all it’s left is a search. I hoped that this would be relatively easy with EE but now I’m not sure.

    I have a channel with addresses of all the dealers which are selling the products of my client and he wants a search which is just based on the postal code. Every postal code has 5 digits.

    So he wants now that if I type the first three digits of the postal code that the search result shows all the entries where the postal code begins with these 3 digits

    So he wants to search for: 123XX
    and EE should give out 12345, 12367, 12389

    But what actually happens is that also the entries show up where these three digits are at the end (or in the middle), like: 67123 or 51235.


    Can I tell the search module somehow that it should only display the entries which have these 3 digits at the beginning?
    I’m a little bit desperate here because this is all what is left to finish the job and actually I don’t want to buy yet another pug-in to get it done.

    Thanks very much in advance for your help.

    Cheers,
    Duffy

  • #2 / Jan 04, 2012 7:27am

    Boyink!

    5011 posts

    I can’t see where you’re going to pull this off using the native search - it just doesn’t have this advanced of configurations.

    As a user of search I’d expect that the site would behave as it is - returning all cases where my search string was found.  Or that it wouldn’t allow me to search on a partial.

    Just for giggles I just tried GM’s dealer locator, and it doesn’t allow searching on partial zipcodes.

  • #3 / Jan 04, 2012 8:25am

    Rob Allen

    3105 posts

    One way to do this would be to split the postal code into two fields, one field for first three numbers and a second field for the remaining numbers.

  • #4 / Jan 04, 2012 8:43am

    Boyink!

    5011 posts

    Or - taking that a step further, have a hidden (CP only) field for the first 3 digits, make that one searchable, and a second field for the entire zip and don’t make it searchable.  That would restrict users to only 3 digit searches though.

  • #5 / Jan 04, 2012 9:18am

    Duffy-D

    5 posts

    Thanks a lot for your replies.

    The idea with the hidden field was exactly my backup-solution if everything else would fail. Good to see that I’m on the right way.

    The search does exactly what it is supposed to do and what everyone would expect. I just hoped that I missed some sort of parameter that could be added or that the way how the digits are typed in would matter. Like not typing 123 but instead typing it like “123**”.

    So I will add another custom field now to my 956 datasets! :(

    Again .. thanks for your help guys.

    Cheers
    Duffy

  • #6 / Jan 05, 2012 5:14am

    John Henry Donovan

    12339 posts

    Glad Rob and Mike were able to help you out here Duffy. Feel free to start a new thread if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases