Is there a way to have one migxLoopCollection call but output the results by the individual fields in their own placeholders instead of one template chunk?
For example if I have a members TV with fields like name, age, phone, email, etc., how can I do something like this:
I saw there is quite a few renderOutput - properties but unfortunately not much of an explanation on how to use them and as some of them are very familiar, I couldn’t figure out if one of the others was doing what I need.
That seems to work in general, although I have this TV nested inside a regular migx TV categories and starting with the second instance of that, the displayed values of the members are wrong, despite the right IDs are getting called for.
[{
"caption": "Categories",
"fields": [{
"field": "category",
"caption": "Category"
},
{
"field": "memberlist",
"caption": "Member",
"inputTV": "member" // migxdb config tv
}
]
}]
Output:
[[+member.name]] ([[+memberId]])
Category A
- Member Joe (1) // correct
- Member Jane (3) // correct
- Member Tom (7) // correct
Category B
- Member Tom (2) // wrong name, right ID
- Member Tom (5) // wrong name, right ID
- Member Tom (4) // correct
Whenever I duplicate a category, all new entry names will be the one from the last entry of the previous category, although if I change the order or remove and add members after that, it will switch up, so I couldn’t find a totally consistent pattern here.
I suspect the placeholders must be interacting with each other across the individual category instances?
I think, this has todo, how MODX tags are parsed.
If a tag is parsed once within a request, the same tag with the same footprint will allways return the same (first) output.
You will need to set different placeholders for each loop within the migxLoopCollection - call. Maybe try &toPlaceholders=`member[[+id]]` and [[+member[[+id]].name]]
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.