I'm trying to extract from a list of products in the cart the (playa) related entries (i want the entry_id's), put them into stash and then i need to use those id's somewhere else to build a "related products" type thing. But as the products in the cart could have the same related entries, i need to make the list it spits out unique. Oh, and there are two playa fields i need to get data from that both have related products but from two different product channels!
So, first we have the setting of the data:
{!-- Get the current items in the basket --}
{exp:cartthrob:cart_items_info}
{!-- Check the products we're getting the info from are in the channel that actually has the related product fields --}
{if channel_id == 7}
{!-- Channel entry loop to get the product data out from the id's the cart_items_info has given us --}
{exp:channel:entries channel="events" entry_id="{entry_id}" dynamic="off"}
{!-- First playa related products field--}
{product_sub_product}
{!-- Stash using unique name the list of entry_id's from playa --}
{exp:stash:set_list name="sub_prods" parse_tags="yes"}
{!-- Stash set name as item_id --}
{stash:item_id}
{entry_id}
{/stash:item_id}
{/exp:stash:set_list}
{/product_sub_product}
{!-- Second playa related products field--}
{product_related_races}
{!-- Stash using unique name the list of entry_id's from playa --}
{exp:stash:set_list name="rel_races" parse_tags="yes"}
{!-- Stash set name as item_id --}
{stash:item_id}
{entry_id}
{/stash:item_id}
{/exp:stash:set_list}
{/product_related_races}
{/exp:channel:entries}
{/if}
{/exp:cartthrob:cart_items_info}
{!-- End of current items in the basket --}
And then we have the getting of the data:
{!-- Get the data out from both sets --}
{exp:stash:get_list name="sub_prods" unique="yes"}
prods - {item_id}<br />
{/exp:stash:get_list}
{exp:stash:get_list name="rel_races" unique="yes"}
races - {item_id}<br />
{/exp:stash:get_list}
What's odd, is that i can see the data in the database so it is all working as expected. But stash get_list is not outputting the data.