How to make row have 4 products instead of 3 on Magento categories page

How to make row have 4 products instead of 3 on Magento categories page

July 7, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to make row have 4 products instead of 3 on Magento categories page

Updating Magento Product Grid Layout: From 3 to 4 Products per Row

Hello developers! Today we’re going to tackle a common question from our new Magento community members - how to change the number of products displayed per row on your category product listing page.

Understanding the Default Magento Product Grid

By default, Magento is configured to display 9 products per page with 3 columns (products) in each row. This layout is defined in:

  1. app/design/frontend/{your theme}/{theme name}/template/catalog/product/list.phtml

In this file, you’ll find the line:

$_columnCount = $this->getColumnCount();

This variable determines how many products are displayed per row based on your current category view.

Your Attempted Solution

You mentioned changing app/design/frontend/mytemplate/template/catalog/product/list.phtml and setting $_columnCount=4. This is a great start! However, the issue you’re facing is due to Magento’s pagination system. When you set the column count manually like this:

$_productCollection = $this->getLoadedProductCollection();
$_productCollection->setPageSize(16);
$i = 0;
foreach ($_productCollection as $_product) {
    if ($i % 4 == 0) {
        echo "<div class=\"products-view\">";
    }
    // Rest of your product template
    $i++;
}

You’re essentially forcing a fixed page size of 16 products, which leads to the uneven distribution you observed.

The Proper Way to Change Product Per Row in Magento

To change the number of products displayed per row correctly, we need to modify both our layout XML file and template file:

  1. Update your layout XML: Navigate to app/design/frontend/{your theme}/{theme name}/layout/catalog.xml. Add or update the following code within <catalog_category_default> tag:
<reference name="content">
    <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
        <action method="setColumnCount"><count>4</count></action>
    </block>
</reference>
  1. Update your product list phtml file: In app/design/frontend/{your theme}/{theme name}/template/catalog/product/list.phtml, you can remove the manual pagination and column count settings:
<?php $_productCollection = $this->getLoadedProductCollection(); ?>
<div class="category-products">
    <ul class="products-grid products-grid--max-<?= $this->getColumnCount() ?>-col">
        <?php foreach ($_productCollection as $_product): ?>
            <li class="item">
                // Rest of your product template
            </li>
        <?php endforeach; ?>
    </ul>
</div>

Conclusion

Remember, when working with Magento, it’s crucial to understand the separate components and files driving each feature. By modifying both the layout XML file and the corresponding phtml template file, you ensure a consistent product grid layout across your category pages.

If you’re looking for more advanced customizations or facing other Magento-related challenges, don’t hesitate to explore LaravelCompany’s Magento Consulting Services. Our experienced team is always ready to provide expert guidance tailored to your specific needs.

Catalog API Themes Admin

Our network