Under my basket page (based on the sample 'checkout.html) I want to suggest any accessories that might be associated with the products in the basket.
I've tried two ways to achieve this, neither is really working for me at the moment. My first attempt was to use PHP to capture the {entry_id} of each item in the first loop and then use that below. Problem I encountered is that I need PHP to be rendered both on InPut and Output on the template (one to capture the id's, the other to make using them possible).
My second attempt is just to have a second {items} loop under the first. Within this loop I try to get the exp:channel:entries with the {entry_id} of each item then within the exp:channel:entries loop get the related_entries (there are 4).
This logic seems sound to me, but I am new to expression engine and store so I am sure I am missing something obvious!
My code is below, any help you can offer is very much appreciated.
<h2>Suggested Accessories / Related Products</h2>
{items}
{exp:channel:entries limit="1" dynamic="off" entry_id="{entry_id}" }
{related_entries id="related_product_1"}
A {title} - {entry_id}
{/related_entries}<br/>
{related_entries id="related_product_2"}
B {title} - {entry_id}
{/related_entries}<br/>
{related_entries id="related_product_3"}
C {title} - {entry_id}
{/related_entries}<br/>
{related_entries id="related_product_4"}
D {title} - {entry_id}
{/related_entries}
{/exp:channel:entries}
{/items}