Increasing K2’s Limit to More than 100 Items

While working on a Joomla website powered by K2, we noticed that one of the pages, containing a big list of company names, is only limited to display the first 100 companies. We checked the backend of the Joomla website, and the limit was set to display 1,000 items for that particular category. We increased the limit on the parent category, but that didn’t work: only the first 100 items were displayed. What could be the reason?

We traced the issue and this trace led us to the file view.html which is located under the components/com_k2/views/itemlist folder. The file had the interesting few lines:

// Protect from large limit requests
if ($limit > 100) {
	$limit = 100;
}

Clearly, the K2 developers thought that whoever sets the limit about 100 must be mistaken, and so they capped the limit to 100 (this subtle cap was later introduced – it wasn’t there before). Removing the above code solved the problem.

Note that we did contact the K2 team over twitter – and they said they will make this (hard-set limit) configurable in the next K2 update.

If you are experiencing the weird 100 item limit in K2, then try the above, this should solve the problem. If you would like help with the fix, or if you need help fixing any other Joomla issue, then please contact us. We are always here to help, our prices are super affordable, and our work is really clean!

No comments yet.

Leave a comment