Access collection tree via id? #6101
stephenmeehanuk
started this conversation in
General
Replies: 2 comments 2 replies
-
Products is an ordered collection? |
Beta Was this translation helpful? Give feedback.
1 reply
-
If the <ul>
{{ products_entries_field }}
<li>
{{ title }}
{{#
Get the nav structure starting at the current product.
Note: I chose 5 for max_depth arbitrarily
#}}
{{ nav:collection:products :from="url" as="entries" max_depth="5" }}
{{#
The start of our inner loop.
This will only show the inner ul if there are any items.
#}}
{{ if entries | count > 0 }}
<ul>
{{# Loop through the entries like normal. #}}
{{ entries }}
<li>{{ title }}</li>
{{#
We can now do our children array (with recursion if we want).
#}}
{{ if children }}
<ul>
{{ children }}
<li>
{{ title }}
{{ if children }}
<ul>{{ *recursive children* }}</ul>
{{ /if }}
</li>
{{ /children }}
</ul>
{{ /if }}
{{ /entries }}
</ul>
{{ /if }}
{{ /nav:collection:products }}
</li>
{{ /products_entries_field }}
</ul> I set up a local test like so: And the above template produces the following result: I think in the original example, the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm using
products_entries_field
to cherry pickentires
fromcollection:products
.collection:products
is being used as a navigation.In
collection:divisions
l'd like to pick a page from fromcollection:products
and display any child pages.I've got this so far.
This will show the parent, but not the children?
Beta Was this translation helpful? Give feedback.
All reactions