I am using the store finder module, and am trying to insert a "title" for each "state". If I have 20 stores in a certain state, I would only like to display the "title" once. Is there any way this could be done with an if statement? to kind of break the loop?

        <li style="width:260px; padding-right:20px; float:left; height:100px;">

            {if address_line1 !=""}         

            {city}, {state} 
            {postal_code}<br />

            {if phone != ""}
            <strong>Phone:</strong> {phone}

            {if url != ""}
            <strong>Website:</strong> <a href="http://www.{url}" target="_blank">{url}</a>        <br/>

  • Try this, {if count == 1}{state}{/if}. Nov 11, 2013 at 16:04
  • Unfortunately count=="1", only brings in the very first state.
    – Funkefied
    Nov 11, 2013 at 18:47
  • I'm a little confused, by "title" for each "state" you mean the title is the name of the state? You're trying to list the stores by State but only show the state once?
    – notacouch
    Nov 13, 2013 at 19:32
  • Correct. I'm trying to add a heading with the state name. Problem being it's in a loop, and it gives the heading above every store. I guess I need a way for the heading with {state} to not duplicate on loop.
    – Funkefied
    Nov 13, 2013 at 19:47

3 Answers 3


There is an add-on from EE Garage that I have used to do that on a store finder before.

It's called NSM Channels. http://ee-garage.com/nsm-channels

Not sure if there is something similar on Devot-ee.com for free, but I know this works.


You can use stash lists. Store the state separately. On output order by the unique states and use a nested get_list to get the entries/stores per state.

(example from Croxton slide: Stash core principles )

{exp:stash:set_list name="my_stores" parse_tags="yes" scope="site"}
        {city}, {state}<br>

Then retrieve the unique states, and accompanying stores via:

{exp:stash:get_list name="my_stores" orderby="item_state" unique="item_state" scope="site"}
  {exp:stash:get_list:nested name="my_stores" orderby="item_name" scope="site"

Note: if you use conditionals, like in your example for address_line1, etc., i'ld suggest adding the parameter parse_conditionals="yes" in set_list.


I think you'll need to enable PHP in the template, set it to parse on input and use it to store the value of {state} on each iteration of the loop, at the top of the loop check to see if state is equal to itself or not, if not the write out the value as a heading. :)

It's possible you might be able to achieve the same result with Stash but I'm not really familiar with that. :)

  • Awesome! i'll give it a shot and report back, thanks.
    – Funkefied
    Nov 13, 2013 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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