GetPage - Pagination - Limit the total results returned

Hello,

I’m working a on project that contains loads of different products. The client would like a section for new products which would be limited to the most recent 27 products (9 products per page, over 3 pages).

This seems like it would be very simple, but I can’t figure out how to limit the total results to 27 or to only return 3 pages of results. It seems like it is all or nothing. Here is the current code I’m working with:

[[!getPage@NewProducts?  
&element=`getResources` 
&parents=`3`  
&where=`{"template:=":3}` 
&tpl=`tmpProductListing` 
&includeTVs=`8,26` 
&processTVs=`8,26` 
&tvPrefix=`tv.` 
&limit=`9`
&pageNavVar=`page.nav`
&sortby=`{"publishedon":"ASC"}`
]]

Any advice? Thanks,
Chris

Have you tried setting &total=27? I think that would work to make getPage think it only had 27 records to work with. Otherwise, you’ll need the element (you could use a custom snippet similar to getResources) to provide a total number of records already limited to 27.

Thanks for the advice, but &total=27 didn’t work. I even tried adding total as a new property to the getPage snippet. The easiest route might be to hard code the pagination since it is only three pages. Not the classiest fix, but it will work. Thanks again.

Rather than hard coding pagination, it might be easier to just hard code the query with a cap of 27. You just need a snippet that can pass limit, offset, and total.