Extension, Module

Archived
Forum
(read-only)

Stash

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Mark Croxton

     

Having trouble getting append_list to work

Support Request

tunnel7
tunnel7

Recently purchased the enterprise edition for stash ... Am attempting to compile a related artists list from a combination of EE entries and Playa parents entries.  The append_list doesn’t seem to want to append the list.  Looking for help with that. 

The example can be seen here: http://dev.nrm.org/artists/norman-rockwell (scroll down on sidebar to the stash items ... all that will go into the stash is the EE entries and when the Playa parents are attempted to add it just adds the {title}, etc.

Ultimately what I am looking to do is combine these two lists, sort them alphabetically and remove duplicates.  I *think* I have that in place but need to get the append to work to test.

Here is the code I have for this ... am also happy to provide logins if helpful.

<h5>Stash Set List 17</h5>
  
  
{!-- WHAT NEEDS TO HAPPEN:
   
DONE Create a related artist stash set list with the name and photos and page url captured
   
NOT WORKING Append the playa field 
   OUTPUT WORKS output using get 
and hope that unique tag works
   
--}
  
  {
!-- BUILD RELATED ARTIST STASH SET --}
  {exp
:stash:set_list
   name
="related_artists" 
   
save="no" 
   
scope="local" 
   
parse_tags="yes"
   
parse_depth="4"
   
replace="no" 
   
output="yes"
  
}
  
   {exp
:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
    
    {ar
-artists show_expired="yes"}
      {stash
:artist_name}{title}{/stash:artist_name} 
      {stash
:artist_img}{ar-photo}{/stash:artist_img}
      {stash
:artist_url}{page_url}{/stash:artist_url}
     {
/ar-artists}
              
   {
/exp:channel:entries}
   
   {
!-- LEFT OFF HERE THE ABOVE WORKS WILL NEED TO APPEND AND USE GET LIST TO OUTPUT --}
   
  {
/exp:stash:set_list}
  
  
  
  {
!-- ADD RELATED PARENTS TO RELATED ARTIST STASH SET --}
  
  {exp
:stash:append_list 
   name
="related_artists"
   
replace="yes"
  
  {exp
:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
  
   {exp
:playa:parents channel="artists"}
    
    {stash
:artist_name}{title} APPEND{/stash:artist_name} 
     {stash
:artist_img}{ar-photo}{/stash:artist_img}
     {stash
:artist_url}{page_url}{/stash:artist_url}
    
   {
/exp:playa:parents} 
  
  {
/exp:channel:entries}
  
  {
/exp:stash:append_list}
  
  
  {
!-- OUTPUT STASH SETREMOVING DUPLICATES AND SORT ALPHABETICALLY --}
  
  
<h5>stash get list</h5>
  
  
{!-- THIS WORKS BUT IS NOT APPENDING ABOVE WITH SAME CODE
  
  
<p>test that playa is pulling something for append_list</p>
  
  
{exp:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
  
   {exp
:playa:parents channel="artists"}
   
    
<h1>{title} TITLE APPEND TEST</h1>
    <
h1>{ar-photo} PHOTO APPEND TEST</h1>
    <
h1>{page_url} URL APPEND TEST</h1
    
   
{/exp:playa:parents} 
  
  {
/exp:channel:entries}
  
  
<p>end test</p>
  
  --
}
  
  
<ul>
  
{exp:stash:get_list 
   name
="related_artists"
   
orderby="artist_name" 
   
sort="asc"
   
unique="yes"}
   
   {
!--
   <
p><img src="{artist_img}"></p>
   <
p><a href="{artist_url}">{artist_name}</a></p
   --
}
    
   
<li class="clearfix">
    <
a href="{artist_url}">
    
{exp:ce_img:pair src="{artist_img}" width="60" height="60" crop="yes"}
     
<img src="{made}" alt="{artist_name}" width="{width}" height="{height}" /> 
    
{/exp:ce_img:pair}
    
<span>{artist_name}</span></a>
   </
li>
     
  
{/exp:stash:get_list}
  
</ul
tunnel7
# 1
tunnel7

UPDATE:  I was able to now get append to kind of work ... it does append one of the playa parents, but doesn’t add the full list (there is about 15 of them).  Here is the latest code:

<h5>Stash Set List 20</h5>
  
  
{!-- WHAT NEEDS TO HAPPEN:
   
DONE Create a related artist stash set list with the name and photos and page url captured
   
NOT WORKING Append the playa field is appending just the first entry
   OUTPUT WORKS output using get 
and hope that unique tag works
   
--}
  
  {
!-- BUILD RELATED ARTIST STASH SET --}
  {exp
:stash:set_list
   name
="related_artists" 
   
save="no" 
   
scope="local" 
   
parse_tags="yes"
   
parse_depth="4"
   
replace="no" 
   
output="yes"
  
}
  
   {exp
:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
    
    {ar
-artists show_expired="yes"}
      {stash
:artist_name}{title}{/stash:artist_name} 
      {stash
:artist_img}{ar-photo}{/stash:artist_img}
      {stash
:artist_url}{page_url}{/stash:artist_url}
     {
/ar-artists}
              
   {
/exp:channel:entries}
   
   {
!-- LEFT OFF HERE THE ABOVE WORKS WILL NEED TO APPEND AND USE GET LIST TO OUTPUT --}
   
  {
/exp:stash:set_list}
  
  
  
  {
!-- ADD RELATED PARENTS TO RELATED ARTIST STASH SET --}
  
  {exp
:stash:append_list 
   name
="related_artists"
   
save="no" 
   
scope="local" 
   
parse_tags="yes"
   
parse_depth="4"
   
replace="yes"
   
output="yes"
  

  
  {exp
:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
  
   {exp
:playa:parents channel="artists"}
    
    {stash
:artist_name}{title} APPEND{/stash:artist_name} 
     {stash
:artist_img}{ar-photo} APPEND{/stash:artist_img}
     {stash
:artist_url}{page_url} APPEND {/stash:artist_url}
    
   {
/exp:playa:parents} 
  
  {
/exp:channel:entries}
  
  {
/exp:stash:append_list}
  
  
  {
!-- OUTPUT STASH SETREMOVING DUPLICATES AND SORT ALPHABETICALLY --}
  
  
<h5>stash get list</h5>
  
  
{!-- THIS WORKS AND PULLS ALL THE PARENTS ... THE APPEND IS ONLY PULLING ONE
  
  
<p>test that playa is pulling something for append_list</p>
  
  
{exp:channel:entries channel="artists" status="open" disable="categories|category_fields|member_data|pagination"}
  
   {exp
:playa:parents channel="artists"}
   
    
<h1>{title} TITLE APPEND TEST</h1>
    <
h1>{ar-photo} PHOTO APPEND TEST</h1>
    <
h1>{page_url} URL APPEND TEST</h1
    
   
{/exp:playa:parents} 
  
  {
/exp:channel:entries}
  
  
<p>end test</p>
  
  --
}
  
  
  
  
<ul>
  
{exp:stash:get_list 
   name
="related_artists"
   
orderby="artist_name" 
   
sort="asc"
   
unique="yes"}
     
   
<li class="clearfix">
    <
a href="{artist_url}">
    
{exp:ce_img:pair src="{artist_img}" width="60" height="60" crop="yes"}
     
<img src="{made}" alt="{artist_name}" width="{width}" height="{height}" /> 
    
{/exp:ce_img:pair}
    
<span>{artist_name}</span></a>
   </
li>
     
  
{/exp:stash:get_list}
  
</ul
Mark Croxton
# 2
Developer
Mark Croxton

Append list can only add one row to a list at a time, you can’t capture multiple rows like with a set_list.

I’d suggest you create two separate lists are join them together. Please see:

https://github.com/croxton/Stash/wiki/{exp:stash:join_lists}

tunnel7
# 3
tunnel7

Thanks Mark.  Appreciate the direction here.  Will work on this now.