get the children foreach parent

web dev asked on January 11, 2019 15:06

hello kentico i have this structure in page Mypage==>CitiesContainer==>Toronto==>LocationContainer==> Apple Sony

in mypage i want get locations of everycity is there any macro like(toronto have apple and sony)

Thanks

Correct Answer

Brenden Kehren answered on January 11, 2019 18:12

I guess I'm not understanding how you'll display these by. Will you be listing out the brands (Apple, Sony, etc.) and for each of them you want to get the locations? And this is all displayed on /MyPage?

If so, you can use something like this macro in your text/xml transformation (not tested):

{%Documents[NodeAliasPath].Parent.Parent.Parent.ApplyTransformation("namespace.class.transformationname")

Then in the transformation you simply use the field macros to list out your locations like this:

<li>{%LocationName|(identity)GlobalAdministrator%}</li>

1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on January 11, 2019 15:51

If your location is always in the same position /Page/Container/Location, you can use a repeater with:

  • the path set to /{0}/{1}/%
  • page type set to whatever your location page type is
  • Levels set to 1

This should get all your cities of that given product.

0 votesVote for this answer Mark as a Correct answer

web dev answered on January 11, 2019 16:28

thanks Brenden Kehren i just need macro to get the locations there cityname

Mypage(macro in this level)==>CitiesContainer==>Toronto==>LocationContainer==> Apple Sony

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.