Is it possible to use pdoPage (part of pdoTools Extra) for SimpleSearch pagination?
Out of the box this is not possible, but I think that with some changes you can make it work.
The following may or may not work:
You have to make some changes to the snippet SimpleSearch
. Therefore duplicate the snippet SimpleSearch
and call it CustomSimpleSearch
.
Then replace the line 66
$response = $search->getSearchResults($searchString, $scriptProperties);
with this code:
$custom_scriptProperties = $scriptProperties;
$custom_scriptProperties['perPage'] = $modx->getOption('limit',$scriptProperties,10);
$custom_scriptProperties['start'] = $modx->getOption('offset',$scriptProperties,0);
$idx = $custom_scriptProperties['start'] + 1;
$response = $search->getSearchResults($searchString, $custom_scriptProperties);
When you now use pdoPage
with this new snippet, the paging should work.
[[!pdoPage?
&elementClass=`modSnippet`
&element=`CustomSimpleSearch`
&perPage=`0`
&placeholderPrefix=`page.`
]]
[[!+page.nav]]
&perPage=`0`
disables the internal pagination
&placeholderPrefix=`page.`
makes sure that pdoPage can read the total number of results