1

I have got a bunch of entries in this relationship and i want to spit them out and group them by day. So, i thought i could use Stash to capture this, group them into a list for each day and the below is my sorry effort.

It does work, but it's not appending the row of data, it's only ever one row as i guess it's creating and destroying those lists over and over. I can't see any other way to do this though. Any ideas would be greatly appreciated!

{parents field="products-lessons-pool"}
   {exp:stash:set_list name='{parents:products-lessons-day}' parse_tags="yes" save="yes" scope="site"}

      {stash:class}{parents:products-lessons-class:title}{/stash:class}
      {stash:time}{parents:products-lessons-time format="%g:%i %a"}{/stash:time}
      {stash:day}{parents:products-lessons-day}{/stash:day}
      {stash:entry_id}{parents:entry_id}{/stash:entry_id}
      {stash:price}{parents:product_price}{/stash:price}

    {/exp:stash:set_list}
{/parents}

1 Answer 1

1

Oh silly me, i had the answer in a code sample on my machine already :-/

{parents field="products-lessons-pool"}
      {exp:stash:append name="Monday" match="#Mon#" against="{parents:products-lessons-day}" parse_tags="yes" save="yes" scope="site" refresh="86400"}
            <tr>
                <td>{parents:products-lessons-class:title}</td>
                <td>{parents:products-lessons-time format="%g:%i %a"}</td>
                <td><a href="/cart_functions/add_to_cart/{parents:entry_id}" class="button success radius">Buy</a><br />
                     {parents:product_price}
                 </td>
            </tr>
       {/exp:stash:append}
 {/parents}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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