The support forum is in archive (read-only) mode and access is limited to members with a purchase history.

For technical support, please visit our support page.

General questions or topics can also be discussed on the ExpressionEngine StackExchange.

   
 
Reverse related entries within cart_items_info loop
Posted: 12 March 2011 04:08 PM   [ Ignore ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

I’m trying to retrieve the entry_ids of items related to those in my cart but entry_id is only returning those of the parent.
In the code below the entry_id within the reverse related loop is coming out the same as the one outside, is there a way round this?

Thanks

{exp:cartthrob:cart_items_info}
                {if first_row}
                    {exp
:cartthrob:update_cart_form id="update_cart_form" return="{template_group}/{template}"}
                    
<input type="hidden" name="return" id="return_url" value="{template_group}/{template}" />
                
{/if}
                    {exp
:channel:entries channel="campaigns" limit="1" entry_id="{entry_id}" dynamic="no"}
                        
<div class="basket-campaign campaign-{entry_id}">
                            <
table cellpadding="10px" style="width:100%;vertical-align:top">
                                <
tr>
                                    <
th colspan="4">
                                        <
h2><span style="color:#999">Campaign:</span{title}</h2>
                                        <
p>Quantity{quantity}</p>
                                        <
p>Subtotal{item_subtotal}</p>
                                        <
p>
                                            <
label for="delete_this_{row_id}">Remove campaign?</label
                                            <
input type="checkbox" id="delete_this_{row_id}" name="delete[{row_id}]">
                                        </
p>
                                    </
th>
                                </
tr>
                                
                                
{reverse_related_entries status="Open|Featured"}
                                    
<tr>
                                        <
td width="25%" style="vertical-align:top;border-right: 0 none">
                                            <
a href="{title_permalink="><img src="{asset_preview}" border="0" style="max-width:150px;max-height: 250px"/></a>
                                        </
td>
                                        <
td width="46%" align="left" style="vertical-align:top;border-left: 0 none">
                                            <
h3>{title}</h3
                                            <
p><strong>Format: </strong>{asset_format}</p>
                                            <
class="description">{asset_desc}</p>
                                            
{if asset_required_extras}
                                                
<p><strong><span class="black">Not included:</span> </strong>{asset_required_extras}</p>
                                            
{/if}
                                        
</td>    
                                        <
td width="13%" align="center">
                                            
£{asset_sale_price}
                                        
</td>
                                        <
td width="13%" align="center">
                                            <
strong>x</strong> <a href="#" class="overlay remove-campaign-asset" id="{entry_id}" rel="store/x_remove-campaign-asset/{entry_id}"Remove</a>
                                        </
td>
                                    </
tr>
                                
{/reverse_related_entries}
                            
</table>
                        </
div>
                    
{/exp:channel:entries}
                                {if last_row} 
                    
<input type="submit" id="checkout_button" class="btn" value="Proceed to Checkout" /> 
                    <
input type="submit" id="update_button" class="btn" value="Update" />
                    
{/exp:cartthrob:update_cart_form}
                {
/if}
            {
/exp:cartthrob:cart_items_info} 
[ Edited: 12 March 2011 08:08 PM by Rob Sanchez ]
Profile
 
 
Posted: 12 March 2011 07:49 PM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Try sticking your entire channel:entries tag into an embed, it’s a parse order issue.

Profile
 
 
Posted: 12 March 2011 08:08 PM   [ Ignore ]   [ # 2 ]
Is a Really Great Dancer
RankRank
Total Posts:  61
Joined  2010-12-03

That did the trick, thanks once again Rob.

Profile
 
 
   
 
 
‹‹ Broken link in docs      Inventory of sizes? ››