Developer forum

Forum » Ecommerce - Standard features » RE: Nested loops

RE: Nested loops

Michael John
Reply

Hi, am trying get a loop from custom product fields in razor, but they won't render. What am I doing wrong?

@foreach (var item in GetLoop("Products")) {
    foreach (var subitem in GetLoop("Klassetrin.Options")) {
        @subitem.TemplateTags()
    }
}

@subitem.TemplateTags() does note render any TemplateTags(). It does however, tell me that it can see TemplateTags() code in the template.

Is it not possible to render nested loops in razor?


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply
This post has been marked as an answer

You need to call GetLoop on the outer loop:

foreach (var subitem in item.GetLoop("Klassetrin.Options")) {

Hope this helps,

Imar

Votes for this answer: 1

 

You must be logged in to post in the forum