0

I'm attempting to insert an Assets field, Grid data along with some other text input fields into a Info Box in a Store Locator page. My code is as follows:

{exp:gmap:results order_by="distance" sort="asc" parse="inward" cache_post="false"}
{if has_searched}
    {results}
        {exp:gmap:marker
            id="map1"
            title="{title}"
            address="{locations_address1} {locations_city}, {locations_state} {locations_zip}"
            extend_bounds="false"
            open_windows="false"
            show_one_window="true"
            clustering="true"
            duplicate_markers="false"
        }
                <div class="locations">
                    {if locations_image}{locations_image}<img src="{exp:ce_img:single src='{locations_image:url}' url_only='yes' width='708' height='396' crop='yes|center,center'}" alt="{alt_text}" class="img-responsive pull-left" />{/locations_image}{/if}
                    <div class="content">
                        <div class="title">{title}</div>
                        <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
                        <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
                        <p class="hours"><strong>Store Hours:</strong><br />
                        {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
                        {/locations_hours}</p>
                    </div>

                </div><!-- end locations -->
        {/exp:gmap:marker}
    {/results}
{if:else}
<div id="locations_wrapper">
    {exp:channel:entries channel="{embed:channel}" status="not closed" sort="desc" orderby="date" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}<div class="locations {switch='pull-left|pull-right'}">
        {if locations_image}{locations_image}<img src="{exp:ce_img:single src='{url}' url_only='yes' width='708' height='396' crop='yes|center,center'}" alt="{alt_text}" class="img-responsive pull-left" />{/locations_image}{/if}
        <div class="content">
            <div class="title">{count}. {title}</div>
            {categories}{if category_url_title == 'john-atencio-store'}<div class="store_type">{category_name}</div>{/if}{/categories}
            <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
            <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
            <p class="hours"><strong>Store Hours:</strong><br />
            {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
            {/locations_hours}</p>
        </div>
        <div class="clearfix"></div>
    </div><!-- end locations -->
    {switch='|<div class="clearfix"></div>'}
    {/exp:channel:entries}
</div><!-- end locations_wrapper -->
{/if}

{if no_results}
    <h2>No locations found, try another search.</h2>
{/if}
{/exp:gmap:results}

What's strange is that my index page works fine with the Assets and Grid. It's just the items in the {if has_searched}{results}...{/results}{if:else} items aren't parsing. The standard fields are working but anything that needs a tag pair to render doesn't.

I'm sure I'm missing something basic or it could be a bug too! :) Isn't everything a bug if you can't figure something out :)?

Thanks for the help on this one!

1 Answer 1

0

It turns out that I just had some loops in the wrong place:

{exp:gmap:results order_by="distance" parse="inward" sort="asc" cache_post="false"}
{if has_searched}<div id="locations_wrapper">
    {results}
        {exp:gmap:marker
            id="map1"
            title="{title}"
            address="{locations_address1} {locations_city}, {locations_state} {locations_zip}"
            extend_bounds="false"
            open_windows="false"
            show_one_window="true"
            clustering="true"
            duplicate_markers="false"
        }
        {exp:channel:entries channel="{embed:channel}" limit="1" status="not closed" sort="desc" orderby="date" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}
            <div class="locations">
                {if locations_image}<img src="{locations_image:url}" alt="{locations_image:alt_tag}" class="img-responsive pull-left" />{/if}
                <div class="content">
                    <div class="title">{title}</div>
                    <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
                    <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
                    <p class="hours"><strong>Store Hours:</strong><br />
                    {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
                    {/locations_hours}</p>
                </div>
            </div><!-- end locations -->
        {/exp:channel:entries}
        {/exp:gmap:marker}
        {exp:channel:entries channel="{embed:channel}" parse="inward" limit="1" status="not closed" sort="desc" orderby="date" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}
            <div class="locations pull-left">
                {if locations_image}<img src="{locations_image:url}" alt="{locations_image:alt_tag}" class="img-responsive pull-left" />{/if}
                <div class="content">
                    <div class="title">{title}</div>
                    {categories}{if category_url_title == 'john-atencio-store'}<div class="store_type">{category_name}</div>{/if}{/categories}
                    <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
                    <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
                    <p class="hours"><strong>Store Hours:</strong><br />
                    {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
                    {/locations_hours}</p>
                </div>
                <div class="clearfix"></div>
            </div><!-- end locations -->
        {/exp:channel:entries}
    {/results}
</div><!-- end locations_wrapper -->{if:else}
        <div id="locations_wrapper">
    {exp:channel:entries channel="{embed:channel}" status="not closed" sort="desc" orderby="date" disable="category_fields|member_data|pagination|trackbacks" dynamic="no"}
        {exp:gmap:marker
            id="map1"
            title="{title}"
            address="{locations_address1} {locations_city}, {locations_state} {locations_zip}"
            extend_bounds="false"
            open_windows="false"
            show_one_window="true"
            clustering="true"
            duplicate_markers="false"
        }
        <div class="locations">
            {if locations_image}{locations_image}<img src="{url}" alt="{title}" class="img-responsive pull-left" />{/locations_image}{/if}
            <div class="content">
                <div class="title">{title}</div>
                <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
                <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
                <p class="hours"><strong>Store Hours:</strong><br />
                {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
                {/locations_hours}</p>
            </div>
        </div><!-- end locations -->
        {/exp:gmap:marker}
            <div class="locations {switch='pull-left|pull-right'}">
                {if locations_image}{locations_image}<img src="{exp:ce_img:single src='{url}' url_only='yes' width='708' height='396' crop='yes|center,center'}" alt="{alt_text}" class="img-responsive pull-left" />{/locations_image}{/if}
                <div class="content">
                    <div class="title">{absolute_count}. {title}</div>
                    {categories}{if category_url_title == 'john-atencio-store'}<div class="store_type">{category_name}</div>{/if}{/categories}
                    <p class="address">{locations_address1},{if locations_address2}<br />{locations_address2}{/if}<br />{locations_city}, {locations_state} {locations_zip}</p>
                    <p class="locations_phone"><strong>Phone:</strong> {locations_phone}</p>
                    <p class="hours"><strong>Store Hours:</strong><br />
                    {locations_hours backspace="6"}<span class="days">{locations_hours:day}</span> <span class="hours">{locations_hours:time}</span><br />
                    {/locations_hours}</p>
                </div>
                <div class="clearfix"></div>
            </div><!-- end locations -->
            {switch='|<div class="clearfix"></div>'}
    {/exp:channel:entries}</div><!-- end locations_wrapper -->
{/if}

{if no_results}
    <h2>No locations found, try another search.</h2>
{/if}
{/exp:gmap:results}

Your Answer

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

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