Jump to content
Tyssen

Showing more than 50 results

Recommended Posts

I'm trying to output a long list of pages. If I do this:

$subpages = $pages->get('/shop/products/')->child->children;

the output is limited to 50 items. If I do this:

$subpages = $pages->get('/shop/products/')->child->children('limit=9999');

the output is also limited to 50. But if I enter any number less than 50, then that's how many get displayed. What am I missing?

Share this post


Link to post
Share on other sites

Just checking: are you absolutely sure that this method returns only 50 items? Do you have any hooks or modules that could affect this... and are you checking right after, i.e. there's no possibility that the list of items was filtered before you check the number of returned items?

$page->children() should return all the children (according to docs too) 🙂

Share this post


Link to post
Share on other sites

I'm outputting the items in an ordered list so that's showing the count for me. The max number it displays is 50.

I've temporarily disabled the site's prepend and append files so the only thing showing on the page now is the output from the selector I posted above.

Are there any config settings either in config.php or in the admin which might restrict the number?

Share this post


Link to post
Share on other sites
Posted (edited)

With your code you’re only getting the children of /shop/products/’s FIRST child. Is that what you expect? If you want all grandchildren of /shop/products/, you could do something like

$products = $pages->find('parent.parent.path=/shop/products/');

(Sorry if that’s not 100%, I just got up lol)

Edited by Jan Romero
added missing “.path” in case someone finds this later
  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks, that was it. 👍 parent.parent didn't work but I did a find on the template instead.

  • Like 1

Share this post


Link to post
Share on other sites

Indeed, sorry. For the record, selecting by grandparent would work like this:

$products = $pages->find('parent.parent.path=/shop/products/');

 

  • Like 1

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...