Magento set "Show All" products by specific category (or in .phtml) rather than globally

Magento set "Show All" products by specific category (or in .phtml) rather than globally

September 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento set "Show All" products by specific category (or in .phtml) rather than globally

Setting Default Products per Page for Specific Magento Categories

As an experienced Magento developer, I often encounter requests from clients who want more granular control over their category pages. The built-in admin setting allows you to set the default number of products per page globally, but what if you need a different behavior for specific categories? In this post, we’ll explore how to achieve this both via the admin panel and programmatically using .phtml files.

Setting via Admin Panel (Limited Flexibility)

While Magento doesn’t provide an out-of-the-box solution to set the number of products per page on a per-category basis through the admin interface, there is a workaround that offers limited flexibility. You can create a custom attribute for your categories and use it conditionally in your category view:

  1. Create a new attribute called “Default Products Per Page” under Catalog > Attributes > Manage Attributes. Set it as a dropdown or number field.

  2. In your category view template (usually located at app/design/frontend/base/default/template/catalog/category/view.phtml), add the following lines to set the limit parameter for the product collection:

<?php $defaultProducts = $_category->getDefaultProductsPerPage(); ?>
<?php $collection = Mage::getModel('catalog/product') 
    ->getCollection()
    ->addCategoryFilter($_category)                        
    ->setOrder('position', 'asc');
$collection->setPageSize($defaultProducts); ?>
  1. In your admin panel, set the value for each category under Catalog > Manage Categories.

While this approach provides some customization, it doesn’t allow you to show “all” products on a specific page without pagination.

Programmatic Solution using .phtml Files (Full Control)

For more advanced control, consider overriding the catalog_category_view block and setting the limit parameter programmatically:

  1. Create a new module in your theme or custom extension following Magento best practices.
  2. In your module’s layout XML file (app/code/local/YourCompany/YourModule/etc/config.xml), add the following override:
<global>
    <blocks>
        <catalog>
            <rewrite>
                <category_view>YourCompany_YourModule_Block_Catalog_Product_List</category_view>
            </rewrite>
        </catalog>
    </blocks>
</global>
  1. Create a new block file app/code/local/YourCompany/YourModule/Block/Catalog/Product/List.php and implement the view logic:
class YourCompany_YourModule_Block_Catalog_Product_List extends Mage_Catalog_Block_Product_List {
    public function getLoadedProductCollection() {
        $categoryId = $this->getCurrentCategory()->getId();
        if ($categoryId == YOUR_SPECIFIC_CATEGORY_ID) { // Replace with your desired category ID
            $collection = parent::getLoadedProductCollection();
            $collection->setPageSize(null);  // Disable pagination for this specific category
        } else {
            $collection = parent::getLoadedProductCollection();
        }
        return $collection;
    }
}

Replace YOUR_SPECIFIC_CATEGORY_ID with the ID of the category you want to target.

This approach allows you to set the number of products per page or disable pagination entirely for specific categories, providing the full control and flexibility required by your business needs.

Remember to clear your Magento cache after making these changes. You can do so via System > Cache Management in the admin panel.

In conclusion, while Magento offers limited built-in functionality for setting product display options on a per-category basis, a combination of custom attributes and programmatic overrides allows you to achieve the desired behavior. By following this approach, you can ensure that your category pages are optimized for both user experience and performance according to your specific requirements.

For more advanced Magento customization techniques like these, consider partnering with us at Laravel Company – we specialize in delivering high-quality Magento development services tailored to our clients’ unique needs.

Catalog Themes Admin Configuration

Our network