0

I have a channel entry for houses in which the user can enter all the details for a house (I simplified the fields for this). For the home page, I am pulling a list of "model homes" that are a multiple relationship field and stashing them for displaying in my template. So I am inside my channel_entries loop for the home page and down a bit in my stash template. Here is my stash segment for this:

My relationship field in the home page is Relationship Field = {model_homes}

{exp:stash:set_list name="sv_model_homes" parse_tags="yes"}
    {model_homes}
        {stash:sv_house_url}{model_homes:url_title}{/stash:sv_house_url}
        {stash:sv_overview}{model_homes:overview}{/stash:sv_overview}
        {exp:stash:set_list name="sv_address" parse_tags="yes"}
            {model_homes:address}
                {stash:sv_street}{address:street}{/stash:sv_street}
                {stash:sv_city}{address:city}{/stash:sv_city}
                {stash:sv_state}{address:state}{/stash:sv_state}
                {stash:sv_zip}{address:zip}{/stash:sv_zip}
            {/model_homes:address}
        {/exp:stash:set_list}
        {exp:stash:set_list name="sv_house_images" parse_tags="yes"}
            {model_homes:house_images cover_only="yes"}
                {stash:sv_house_image_full}{image:url{/stash:sv_house_image_full}
                {stash:sv_house_image}{image:url:gallery}{/stash:sv_house_image}
                {stash:sv_house_title}{image:title}{/stash:sv_house_title}
            {/model_homes:house_images}
        {/exp:stash:set_list}
        {exp:stash:set_list name="sv_details" parse_tags="yes"}
            {model_homes:house_details}
                {stash:sv_price}{house_details:price}{/stash:sv_price}
                {stash:sv_bedrooms}{house_details:bedrooms}{/stash:sv_bedrooms}
                {stash:sv_bathrooms}{house_details:bathrooms}{/stash:sv_bathrooms}
                {stash:sv_living_rooms}{house_details:living_rooms}{/stash:sv_living_rooms}
                {stash:sv_dining_rooms}{house_details:dining_rooms}{/stash:sv_dining_rooms}
                {stash:sv_square_footage}{house_details:square_footage}{/stash:sv_square_footage}
            {/model_homes:house_details}
        {/exp:stash:set_list}
    {/model_homes}
{/exp:stash:set_list}

Inside the houses channel fields are the following grid and channel_images fields.

INSIDE the homes entry are the following fields giving me trouble:

GRID - {address}

CHANNEL IMAGES - {house_images}

GRID - {house_details}

This is my {content_home} template (display) for this content segment:

<ul class="slides">
    <li>
        <div class="row">
            {exp:stash:get_list name='sv_model_homes'}

            <div class="col-md-4 col-sm-6">
                <div class="thumbnail boxed">
                    <div class="listing-image">
                        <span class="listing-tag important">Model Home</span>
                        {exp:stash:get_list:nested name='sv_house_images'}
                        <img src="{sv_house_image}" alt="{sv_house_title}">
                        <div class="image-links">
                            <div class="left">
                                <a class="inner" href="{sv_house_image_full}" data-lightbox="related-1">
                                    <i class="fa fa-camera"></i>
                                </a>
                            </div>
                            <div class="right">
                                <a class="inner" href="{site_url}house/{sv_house_url}">
                                    <i class="fa fa-link"></i>
                                </a>
                            </div>
                        </div>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details'}
                        <div class="image-tags">
                            <ul class="property-tags">
                                <li><span><i class="icon-bed"></i> {sv_bedrooms}<br><span class="small">Bedrooms</span></span></li>
                                <li><span><i class="icon-shower"></i> {sv_bathrooms}<br><span class="small">Bathrooms</span></span></li>
                            </ul>
                        </div>
                        {/exp:stash:get_list:nested}
                    </div>
                    <div class="description">
                        {exp:stash:get_list:nested name='sv_address'}
                        <h4>{sv_street}<br><small>{sv_city}, {sv_state}</small></h4>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details'}
                        <div class="row">
                            <div class="col-xs-6">
                                <strong>Property Size:</strong>
                            </div>
                            <div class="col-xs-6">
                                {sv_square_footage} SqFt
                            </div>
                            <div class="col-xs-6">
                                <strong>Rooms:</strong>
                            </div>
                            <div class="col-xs-6">
                                {sv_bedrooms} Bed, {sv_bathrooms} Bath
                            </div>
                        </div>
                        <hr>
                                                    <span class="price-tag">
                                                        ${sv_price}
                                                    </span>
                        {/exp:stash:get_list:nested}
                        <a href="{site_url}house/{sv_house_url}" class="btn btn-link " role="button">+ Show Details</a>
                    </div>
                </div>
            </div>

            {/exp:stash:get_list}

        </div>
    </li>
</ul>

The problem is that I AM getting information, just not the correct information.

If I test the loop like this:

<div class="row">
    {exp:stash:get_list name='sv_model_homes'}
        {sv_house_url} - {count}<br>
    {/exp:stash:get_list}
</div>

I get the proper {sv_house_url} and {count}. It loops through the trhee tests and count 1, 2, 3.

However, in my markup for {content_home}, (above), I just get the first entry. I've tried using the prefix=''tag, but that didn't change anything for me. (I could have been using it incorrectly too though.)

What do I need to do in order to get the proper data from my stash set_list?

2 Answers 2

0

I think you may have forgot to nest your nested set_lists? Looks like you're doing it on your nested get_lists, however.

These set_lists need to be nested.

  • sv_address
  • sv_house_images
  • sv_details

Also, I'm not sure but, you may need to use the context param on those nested set_lists and nested get_lists too. Maybe along with the {entry_id}. And this would come after fixing your nesting so if nesting fixes all your issues then disregard this part.

0

First off, thanks for the input @Natetronn. If this is what you were talking about, let me know so I can accept your answer. :)

I tried using the context param before and after rounding out the nesting, but wasn't able to get it functioning properly for this. Even after nesting the lists I was still just capturing a single one of the loop data sets. I think the context parameter is supposed to handle setting and retrieving this way too from what I read, but I wasn't able to get that working. If I am doing this the hard way and context works this way, please let me know so that I can utilize the addon properly. :)

I was able to achieve my desired results using the following "set_list". Again, simplified, but I'm including the {channels_entry} tags to make it more clear for those that may need more info.

{exp:channel:entries
    channel="home_page"
    limit="1"
}
    {exp:stash:sv_title}{title}{/exp:stash:sv_title}
    {exp:stash:sv_url_title}{url_title}{/exp:stash:sv_url_title}
    {exp:stash:sv_entry_id}{entry_id}{/exp:stash:sv_entry_id}
    {exp:stash:sv_entry_date}{entry_date format="%Y %m %d"}{/exp:stash:sv_entry_date}
    {exp:stash:sv_edit_date}{edit_date format="%Y %m %d"}{/exp:stash:sv_edit_date}
    {exp:stash:set_list name="slideshow_images" parse_tags="yes"}
        {slideshow}
            {slideshow:slider_images}
                {stash:sv_slideshow_image}{image:url:slider-optimized}{/stash:sv_slideshow_image}
                {stash:sv_slideshow_title}{image:title}{/stash:sv_slideshow_title}
            {/slideshow:slider_images}
        {/slideshow}
    {/exp:stash:set_list}
    {exp:stash:sv_welcome_title}{welcome_title}{/exp:stash:sv_welcome_title}
    {exp:stash:sv_welcome_greeting}{welcome_greeting}{/exp:stash:sv_welcome_greeting}
    {exp:stash:set_list name="sv_model_homes" parse_tags="yes" parse_depth="2"}
        {model_homes}
            {stash:sv_house_id}{model_homes:entry_id}{/stash:sv_house_id}
            {stash:sv_house_url}{model_homes:url_title}{/stash:sv_house_url}
            {stash:sv_overview}{model_homes:overview}{/stash:sv_overview}
            {exp:stash:set_list:nested name="sv_address_{model_homes:entry_id}" context parse_tags="yes"}
                {model_homes:address}
                    {stash:sv_street}{address:street}{/stash:sv_street}
                    {stash:sv_city}{address:city}{/stash:sv_city}
                    {stash:sv_state}{address:state}{/stash:sv_state}
                    {stash:sv_zip}{address:zip}{/stash:sv_zip}
                {/model_homes:address}
            {/exp:stash:set_list:nested}
            {exp:stash:set_list:nested name="sv_house_images_{model_homes:entry_id}" parse_tags="yes"}
                {model_homes:house_images cover_only="yes"}
                    {stash:sv_house_image_full}{image:url}{/stash:sv_house_image_full}
                    {stash:sv_house_image}{image:url:gallery}{/stash:sv_house_image}
                    {stash:sv_house_title}{image:title}{/stash:sv_house_title}
                {/model_homes:house_images}
            {/exp:stash:set_list:nested}
            {exp:stash:set_list:nested name="sv_details_{model_homes:entry_id}" parse_tags="yes"}
                {model_homes:house_details}
                    {stash:sv_price}{house_details:price}{/stash:sv_price}
                    {stash:sv_bedrooms}{house_details:bedrooms}{/stash:sv_bedrooms}
                    {stash:sv_bathrooms}{house_details:bathrooms}{/stash:sv_bathrooms}
                    {stash:sv_living_rooms}{house_details:living_rooms}{/stash:sv_living_rooms}
                    {stash:sv_dining_rooms}{house_details:dining_rooms}{/stash:sv_dining_rooms}
                    {stash:sv_square_footage}{house_details:square_footage}{/stash:sv_square_footage}
                {/model_homes:house_details}
            {/exp:stash:set_list:nested}
        {/model_homes}
    {/exp:stash:set_list}
{/exp:channel:entries}

Then in my "get_list", I achieved what I needed by pulling out the data like this:

<div class="flexslider title-slider" data-animation="fade" data-loop="true">
    <div class="title">Model Homes</div>
    <ul class="slides">
        {exp:stash:get_list name='sv_model_homes'}
            {switch='<li><div class="row">||'}
            <div class="col-md-4 col-sm-6">
                <div class="thumbnail boxed">
                    <div class="listing-image">
                        <span class="listing-tag important">Model Home</span>
                        {exp:stash:get_list:nested name='sv_house_images_{sv_house_id}'}
                            <img src="{sv_house_image}" alt="{sv_house_title}">
                            <div class="image-links">
                                <div class="left">
                                    <a class="inner" href="{sv_house_image_full}" data-lightbox="related-1">
                                        <i class="fa fa-camera"></i>
                                    </a>
                                </div>
                                <div class="right">
                                    <a class="inner" href="{site_url}house/{sv_house_url}">
                                        <i class="fa fa-link"></i>
                                    </a>
                                </div>
                            </div>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details_{sv_house_id}'}
                            <div class="image-tags">
                                <ul class="property-tags">
                                    <li><span><i class="icon-bed"></i> {sv_bedrooms}<br><span class="small">Bedrooms</span></span></li>
                                    <li><span><i class="icon-shower"></i> {sv_bathrooms}<br><span class="small">Bathrooms</span></span></li>
                                </ul>
                            </div>
                        {/exp:stash:get_list:nested}
                    </div>
                    <div class="description">
                        {exp:stash:get_list:nested name='sv_address_{sv_house_id}'}
                            <h4>{sv_street}<br><small>{sv_city}, {sv_state}</small></h4>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details_{sv_house_id}'}
                            <div class="row">
                                <div class="col-xs-6">
                                    <strong>Property Size:</strong>
                                </div>
                                <div class="col-xs-6">
                                    {sv_square_footage} SqFt
                                </div>
                                <div class="col-xs-6">
                                    <strong>Rooms:</strong>
                                </div>
                                <div class="col-xs-6">
                                    {sv_bedrooms} Bed, {sv_bathrooms} Bath
                                </div>
                            </div>
                            <hr>
                            <span class="price-tag">
                                ${sv_price}
                            </span>
                        {/exp:stash:get_list:nested}
                        <a href="{site_url}house/{sv_house_url}" class="btn btn-link " role="button">+ Show Details</a>
                    </div>
                </div>
            </div>
            {if count == absolute_results}
                </div></li>
            {if:else}
                {switch='||</div></li>'}
            {/if}
        {/exp:stash:get_list}
    </ul>
</div>

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.