0

I'm looking for a bit of guidance here, just need pointing in the right direction for. A solid solution.

Would this be possible with ExpressionEngine? Either using something like Low Search or even the Simple Search??

Step 1: Person enters: Surname, Postcode, Client reference number

Step 2: If those details match with the data in an entry(?), they then get put through to a confirmation page which is personalised with a unique code – this unique code will be already existing in the entry.

In step 1, the data inputted will need to match exactly so there is no risk of someone accidentally getting someone else's unique code. So blank spaces will need to be removed maybe??

Happy to take advice on a better way rather than entering x3 search fields.

Thanks

UPDATE

Here is the code I am using now.

Kind of works but I cannot get it to match exactly. For example searching for "Steve" or "Steven" in the first name field returns the same result. Where the actual name in the entry is "Steve". And then the client reference number returns the same result if "1234" or "12345" is enetered, where in the actual entry it is "1234".

Form:

{exp:low_search:form 
            result_page="/site/success"
            collection="season_ticket_holder"
            required="search:firstname|search:surname|search:clientref|search:postcode" 
            require_all="search:firstname|search:surname|search:clientref|search:postcode" 
            exact="search:firstname|search:surname|search:clientref|search:postcode"
        }

        <div class="form-area">

            <p class="form-element">
                <label for="firstname">First name<em>*</em></label>
                <input type="text" name="search:firstname" id="firstname" class="txtbox">
            </p>

            <p class="form-element">
                <label for="surname">Surname<em>*</em></label>
                <input type="text" name="search:surname" id="surname" class="txtbox">
            </p>

            <p class="form-element">
                <label for="clientref">Client Ref<em>*</em></label>
                <input type="text" name="search:clientref" id="clientref" class="txtbox nowhite">
            </p>

            <p class="form-element">
                <label for="postcode">Postcode<em>*</em></label>
                <input type="text" name="search:postcode" id="postcode" class="txtbox">
            </p>            

        </div>

        <input type="submit" id="submit" class="submit" name="submit" value="Submit &#8250;" />

        {error_message}

        {/exp:low_search:form}

Results page:

    {exp:low_search:results 
query="{segment_3}" 
}
  {title} {first_name} {surname} {client_ref} {postcode}
  <h1>{discount}</h1>
  {if no_results}No search results{/if}
{/exp:low_search:results}   

Collection Settings:

Collection settings

FIX: problem solved, the issue was the search fields were not matching the custom field names. firstname = first_name. Thanks to Low for sorting that.

1

Looking at your example code, you've got several filter parameters in your Form tag. And as stated:

these parameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag.

Setting them as parameters in the Form tag will not work. In your case, that's the collection, require_all and exact parameters.

Secondly, the parameter you need (and which should be placed on your Results tag) is exact only. You don't need the require_all parameter, as all parameters (and fields, in this case) target a single value. Note that these params will act as tho you set search:field_name on a channel:entries tag.

Thirdly, your search form uses the Field Search filter only. That's fine, but that also means you don't need to define a collection, as that's only used for the Keywords filter. Therefore, the settings you have defined in the Collection (specifically the field weighting) have no influence whatsoever on your search results.

tl;dr:

  • Move the exact param to the Results tag;
  • Remove the collection and require_all params from the Form tag.

Oh, and remove the name="submit" attribute from your submit button for good measure.

Edit:

Also make sure your field names match. So, search:field_name, where field_name exactly matches the name of the field you're targeting. firstname != first_name

| improve this answer | |
  • Thanks, Hmmm I've updated the code as your suggestions above but now the search is even weaker, I don't have to complete any of the fields fully and it will return the result. I need it to work only if the firstname,surname, client ref and postcode are an exact match, with no variations. – Mark Aug 16 '16 at 9:43
  • If you followed the instructions, that should be the case. If you're getting unexpected results, open a support thread over at GetSat. – Low Aug 16 '16 at 9:53
  • Cheers Mr Low.... – Mark Aug 16 '16 at 9:56
0

I would imagine this approach would be doable in Low Search.

You would need to define a collection that comprised the three fields that you are looking for matches in (surname, postcode, client ref), and define the unique code field as the {low_search_excerpt}. Then run the search as an inclusive stack - so all three terms have to be found in a result rather than any one of the three.

HTH

| improve this answer | |
  • Thanks for this, so if two people had the same surname of "Jones" but obviously had different postcode and client ref number would it only return the one that matches all three?I do not want any possibility of the search returning the wrong or multiple results Finally, if the entry has stored the postcode as SO506HG but they enter SO50 6HG (with a space) will it still successfully find it? Thanks for your help – Mark Jul 25 '16 at 9:57
  • Yep - if you follow link in original reply to "inclusive stack" you'll see that for Low Search that's exactly what you get - requiring an "AND" operator joining the three elements (so "surname" AND "postcode" AND "client ref") - rather than the default for low search is an "OR" operator. – JCOGS Design Jul 25 '16 at 16:14
  • Hi Gavin, I have updated my question above with an example. I cannot seem to get it to match EXACTLY what is in the chanel entry. I can get the same results still when using slightly modified versions of the actual data. E.G "steve" and "steven" will return the same result. Where "steven" isnt in the channel entry. – Mark Aug 16 '16 at 6:25
  • Hi - you need to tell Low Search to not do that... it is all in the (excellent) Low Search documentation (here - gotolow.com/addons/low-search/docs/filters). To fix the specific case you mention I think you need to add the parameter keywords:stem="no" to your results tag. But to stop this kind of thing more fully, check out the keywords section of documentation on page linked to - you'll see there are many options. HTH – JCOGS Design Aug 16 '16 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.