Jump to content

how do i make processwire find images 2 layer pages deep


picarica
 Share

Recommended Posts

ok sorry for confusing title but what i am tryin to do that my page will fetch images from the deepest layer of its children i will show it

replace.png.e31bb3758e62bd95cff29883420590cf.png

so as you can see i have  Produkty and the n have 3 children which 2 of then includes final procuts and first children has anotehr 2 categories and the nit has final children

so right now i have it like this
 

if ($page->hasChildren()) {
                    foreach ($page->children as $child) {
                        $image = $child->r_produkty_image->first();

//some code

}

and it only fetches thumbnails of products only 1 child deep.

so for example for Terasové prestrešenia to be shown in products i need to upload pictures to that page

but i would like that Terasové prestrešenia would fetch image from S dizajnom strechy so spádom and that would fetch image from Lapure which is final product and should and will include images. so that those categories wont include unesecary field and images

sorry for complexity and bad english i hope you get me

Link to comment
Share on other sites

2 hours ago, picarica said:

sorry for complexity and bad english i hope you get me

Not sure ? 

$pages->find("template=product, has_parent=123, r_produkty_image.count>0");

This should find all your pages and images... Where product is the template of the pages that you want to find and 123 is the id of your Produkty page.

Does that help?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...