Hi,
I'm doing some small changes to an old site, and just stumbeled across a weird behavior.
Trying to build a Google Shopping feed, but when I try to render variants they turn out empty.
Simplifyed code which doesn't render anything in the second foreach:
@foreach (LoopItem i in GetLoop("Products")){ var variants = i.GetLoop("VariantCombinations"); <item> <g:title>@i.GetValue("Ecom:Product.Name")</g:title> </item> if(variants.Any()){ foreach (LoopItem v in variants){ <item> <g:title>@v.GetValue("Ecom:Product.Name")</g:title> </item> } } }
If I then add TemplateTags() somewhere, doesn't matter where... the second foreach will render...
@TemplateTags() @foreach (LoopItem i in GetLoop("Products")){ var variants = i.GetLoop("VariantCombinations"); <item> <g:title>@i.GetValue("Ecom:Product.Name") OR HERE @i.TemplateTags()</g:title> </item> if(variants.Any()){ foreach (LoopItem v in variants){ <item> <g:title>@v.GetValue("Ecom:Product.Name")</g:title> </item> } } }
Am I doing something wrong here, or is this a bug?