Hi everybody,
Trying to come up with a recursive method, to iterate throgh parent tree og a group.
I have a structure of 4 levels in ecom groups, and I need to trace back the parent of each group in the path.
what I have so far:
@helper RenderParentEcomNav(Dynamicweb.eCommerce.Products.Group group) { if(group.ParentGroupsDefaultLanguage != null){ var parent = Dynamicweb.eCommerce.Products.Group.GetGroupByID(group.PrimaryParentGroupID); if (parent != null) { @RenderParentEcomNav(parent) }else{ <text><li>Shop-root</li></text> } } <li>@group.ID</li> }
But am getting null or 'emptyspace' when I am calling the parent of my parent - therefore null pointer exceltion.
It's because after putting in an original group - it gets parent - but than next time that parent.PrimaryParentGroupID is null.
Is that the way to get the group parent, or should I try something else,
I also tryed:
group.ParentGroups[0].ID
but same results.
Any suggestions?
/Dmitrij