Jump to content

Recommended Posts

Posted

Hello, Just started w/PW a couple days ago. I am trying to use a category tree I have made to refine the results shown instead of just showing pages with just the one category that was clicked on by the user (unless it is the last category in that branch.

I have many images, all using a single "image" template. One image/One Page. Each image page has a field for "location_category" (in addition to numerous other fields for each image)

I've created another template "location_category" and made my category tree under that. My menu markup on the front end appears to be working fine,

Eg:

Locations->

  California->

    Los Angeles->

      Hollywood->

         West Hollywood

  San Diego->

    Mission Beach

    Pacific Beach

 

I am trying to make it so when a user clicks on "California", all images in California are shown in the results, when they click down to Hollywood, then only images for Hollywood and West Hollywood are shown etc.

Code I am using now only shows the items in that exact category-
$pano_results = $pages->find("location_category=$page,  sort=-shoot_date, limit=10");

What are the additional selectors I will need to achieve the above? I am not having much luck finding the precise method because of so many different variations of people's issues with page selects and parents/children.

I hope there is a simple method?

 

Thanks

 

Posted

Welcome to the forums @mikhail :-)

$page->find() could be useful here. I think something like this should do the trick:

// This category plus all child categories under it
$categories = $page->find()->prepend($page);

$pano_results = $pages->find("location_category=$categories, sort=-shoot_date, limit=10");

 

  • Like 4

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
  • Recently Browsing   0 members

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