im trying to use razor templates on an ecom product template but ive run into a problem.
code in oldschool template
<div id="RelatedGroups" class="eComList"> <!--@LoopStart(ProductRelatedGroups)--> <div class="RelatedHeader"><!--@Ecom:Product:RelatedGroup.Name--></div> <!--@LoopStart(RelatedProducts)--> <div class="eComContainer Position<!--@RelatedProducts.LoopMod4-->"> <div class="BoxHeader"> <h2><!--@Ecom:Product.Name--></h2> </div> </div> <!--@LoopEnd(RelatedProducts)--> <!--@LoopEnd(ProductRelatedGroups)--> </div>
But if i want to do the same thing in Razor it will give an issue with the loop i another loop
this i the pseudocode which will not work atm.
@: <div id="RelatedGroups" class="eComList"> foreach (LoopItem i in GetLoop("ProductRelatedGroups")){ @: <div class="RelatedHeader">@i.GetValue("Ecom:Product:RelatedGroup.Name")</div> foreach (LoopItem i2 in i.GetLoop("RelatedProducts")){ @: <div class="eComContainer Position @i2.GetValue("RelatedProducts.LoopMod4")"> @: <div class="BoxHeader"> @: <h2>@i2.GetValue("Ecom:Product.Name")</h2> @: </div> @: </div> } } @: </div>
The first loop works but the inner loop won't
Any ideas on how to do this?