I have an empty stash list, as expected. I need to output some alternative content if the list is empty. I've tried using conditionals and {count} but to no prevail.
Any ideas how I can do this. I am using Stash and Expresso Store. I need to allow users to seamlessly switch between purchased and purchased products.
Any help, greatly appreciated
Here is my list
{exp:store:orders member_id='CURRENT_USER' order_by='order_date' sort='desc'}
{items}
{exp:channel:entries entry_id="{entry_id}" channel="series"}
{exp:stash:set_list name="series_list" parse_tags="yes" parse_depth="3" context="{url_title}"}
{stash:item_entry_id}{entry_id}{/stash:item_entry_id}
{stash:item_title}{title}{/stash:item_title}
{exp:stash:set_list:nested name="series_list_episodes" parse_tags="yes" context="{entry_id}"}
{series_episodes}
{stash:episode_title}{series_episodes:title}{/stash:episode_title}
{stash:episode_number}{series_episodes:episode_number}{/stash:episode_number}
{stash:episode_teaser}{series_episodes:series_episodes:episode_teaser}{/stash:episode_teaser}
{stash:episode_duration}{series_episodes:episode_duration}{/stash:episode_duration}
{series_episodes:episode}
{stash:desktop_url}{episode:desktop_url}{/stash:desktop_url}
{stash:mobile_url}{episode:mobile_url}{/stash:mobile_url}
{stash:placeholder_image}{episode:placeholder_image}{/stash:placeholder_image}
{/series_episodes:episode}
{/series_episodes}
{/exp:stash:set_list:nested}
{/exp:stash:set_list}
{/exp:channel:entries}
{/items}
{/exp:store:orders}
And here is the output:
{exp:stash:get_list name="series_list" context="{segment_3}"}
{!-- if no results/list empty load another product --}
{!-- chuff removed --}
{item_title}
{exp:stash:get_list:nested name="series_list_episodes" context="{item_entry_id}" prefix="nested" }
{!-- bla bla this all works nicely, just stash variables used in the embed --}
{/exp:stash:get_list:nested}
</ul>
{/exp:stash:get_list}
UPDATE
A little background to my issue.
I am building a ecommerce site that gives users access to some streaming video content.
From within one template I need to be able to list products which have been purchased and products which haven't been purchased.
With the list above, I was hoping to return some content based on the {segment_3} value, if there is no content, so rather than using the exp:store:orders loop, I'd use the standard channel entries loop with the url_title set to {segment_3} (i've not coded this part yet, Just at the stage where I need to return 'something' if the list returns nothing.
{if no_results}
should work fine withget_list
and I see you're aware ofprefix=
. So is your issue how to display alternative content when you have nothing to work with? – notacouch Apr 23 '14 at 23:29