Developer forum

Forum » Ecommerce - Standard features » Multiple ProductRelatedGroups

Multiple ProductRelatedGroups

Jonas Mersholm
Reply

Hi,

I'm doing the following with razor:

            @foreach( var RelatedGroups in GetLoop("ProductRelatedGroups") )
            {
                if( RelatedGroups.GetString("Ecom:Product:RelatedGroup.GroupID").Equals("RELGRP9") )
                {
                    foreach(var DescriptionProducts in RelatedGroups.GetLoop("Products") )
                    {
                        foreach( var DescriptionSubProducts in DescriptionProducts.GetLoop("ProductRelatedGroups") )
                        {
                            foreach( var SubProduct in DescriptionSubProducts.GetLoop("Products") )
                            {
                                Description += SubProduct.GetString("Ecom:Product.LongDescription") + "<br />";
                            }
                        }
                    }
                }
            }
        }

 

But it seems like it wont work with the inner "ProductRelatedGroups" if i do a :
DescriptionProducts.GetLoop("ProductRelatedGroups").Count, it returns 0 even though the given product actually has 3 groups attached.

Cant i get the related groups of, of a product fetched by a related group?

 

Jonas


Replies

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Jonas

This is not possible using template tags, need I say of course....

You would have to query the API instead - but this could be an expensive operation going this deep.

Votes for this answer: 1
 
Jonas Mersholm
Reply

Hi Nicolai,

Thank you for the answer :)

 

You must be logged in to post in the forum