Search Block: Change number of results per page in Search Results
By David Reeder, 14 October 2024
You can change the number of results per page in the search results that are generated by the Search block. Imagine you want 18 results per page:
- Create a custom controller, by copying the file \concrete\blocks\search\controller.php to \application\blocks\search\controller.php
- Update the namespace at the top. Change it from namespace Concrete\Block\Search; to namespace Application\Block\Search;
- Find this line: $pagination = $ipl->getPagination();
- After it add a new line with: $pagination->setMaxPerPage(18);
- When you perform a search, if there are more than 18 results you will see 18 on page one of the search results.