Magento incorrect product count when limit=all on product list page

Magento incorrect product count when limit=all on product list page

August 31, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento incorrect product count when limit=all on product list page

Magento Product Count Issue: Solving the “limit=all” Mystery

As a seasoned Magento developer, I often encounter puzzling issues during upgrade processes. One such challenge faced recently involved an incorrect product count on the product list view pages of a pre-1.4 site being upgraded to version 1.4.1.2.

Understanding the Initial Configuration

The system configuration for the catalog section was set up as follows:

<List Mode>Grid Only</List Mode>
<Products per Page on Grid Allowed Values>8,16,32</Products per Page on Grid Allowed Values>
<Products per Page on Grid Default Value>8</Products per Page on Grid Default Value>
<Allow All Products per Page>Yes</Allow All Products per Page>

Noticeably, there were no explicit limits set in the layout file THEME/layout/catalog.xml. However, when using the “limit=all” parameter, only 10 products were displayed—regardless of the actual product count.

Diving into the Code

Using FirePHP to inspect the product list page for a category with 184 products revealed some contradictory results:

limit=16
$this->getLoadedProductCollection()->count() returns 16
$this->getLoadedProductCollection()->getSize() returns 184
$this->getCollection()->getSize() returns 184

limit=all
$this->getLoadedProductCollection()->count() returns 10
$this->getLoadedProductCollection()->getSize() returns 184
$this->getCollection()->getSize() returns 184

Initially, I suspected the issue might lie within the _getProductCollection() method of Mage_Catalog_Block_Product_List. However, closer inspection revealed no query limits set anywhere in this method.

Uncovering the Root Cause

After further investigation, a critical discovery was made: the discrepancy occurs only in custom themes. When switching to the “base” package theme, the “limit=all” condition correctly returns the total product count for both count() and getSize().

The custom theme has minimal changes—primarily markup and CSS adjustments—in the list.phtml file compared to the base version.

Resolving the Issue

To fix this problem:

  1. Check for Customizations: Verify if any customizations have been made to the list.phtml file or its parent template files that might inadvertently limit the product count.

  2. Compare Base and Custom Files: Ensure the PHP code structure in your custom theme is identical to the base package version. Any deviations could introduce unexpected behavior.

  3. Update Theme: If possible, consider updating your custom theme using Magento’s default theme as a reference. This can help eliminate any hidden conflicts causing the issue.

  4. Revert Changes: If resolving the exact cause proves challenging, reverting to the default base package theme for troubleshooting purposes is often beneficial.

Conclusion

In this case study, we observed an intriguing interaction between Magento’s configuration settings and custom theme files that led to an incorrect product count display when using “limit=all”.

This issue underscores the importance of meticulous code reviews during theme creation and the potential pitfalls of making seemingly minor adjustments. It serves as a reminder for developers to always compare against default templates and ensure consistent behavior across themes.

For a more in-depth exploration of Magento upgrade processes and best practices, I recommend visiting Laravel Company. Their resources provide valuable insights into managing these complex e-commerce platforms effectively.

Catalog Themes Admin Configuration

Our network