Get latest or new products on home page in magento with layout update

Get latest or new products on home page in magento with layout update

September 2, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Get latest or new products on home page in magento with layout update

Displaying New Products on Homepage in Magento: A Comprehensive Guide

Hello everyone! Today, we’re going to tackle a common question I often receive from my clients and readers - how to display the latest or new products on the homepage of your Magento store using layout updates.

Why is this important? Showcasing new arrivals can significantly boost customer engagement and drive sales. It’s an essential feature for any modern e-commerce platform.

The Current Scenario

You’ve already made great progress by copying the core catalog/product/list.phtml file to your theme folder, allowing you to customize it. You also have a layout update in place for your homepage:

<reference name="content">
   <block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
      <action method="setCategoryId"><category_id>3</category_id></action>
      <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
         <block type="page/html_pager" name="product_list_toolbar_pager"/>
      </block>
      <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
   </block>
</reference>

This works fine, but it’s currently tied to a specific category ID (3 in this case). You want to display new products from all categories.

The Challenge

The main hurdle here is that the setCategoryId action specifically filters the product list by the specified category. If you remove or modify this action, the default behavior will still filter by category instead of showing all new products across your store.

The Solution: A Custom Product Collection

To achieve this, we need to create a custom product collection that ignores the category filter and sorts products by their creation date in descending order (i.e., newest first).

Let me walk you through the steps:

  1. Create a new block: In your app/code/local/YourVendor/YourModule/etc/config.xml file, add the following:
<global>
    <blocks>
        <yourvendor_yourmodule>
            <class>YourVendor_YourModule_Block</class>
        </yourvendor_yourmodule>
    </blocks>
</global>
  1. Create the new block: In app/code/local/YourVendor/YourModule/Block/Product/New.php, implement the following:
<?php

class YourVendor_YourModule_Block_Product_New extends Mage_Core_Block_Template
{
    public function getNewProducts()
    {
        $collection = Mage::getResourceModel('catalog/product_collection');

        // Sort by created_at field in descending order (newest first)
        $collection->addAttributeToSort('created_at', 'desc');

        return $collection;
    }
}
  1. Update your layout: In your homepage’s layout XML file, replace the existing product_list block with a new one that uses our custom block:
<reference name="content">
   <block type="yourvendor_yourmodule/product_new" name="new_products" template="catalog/product/list.phtml">
      <block type="catalog/product_list_toolbar" name="new_products_toolbar" template="catalog/product/list/toolbar.phtml">
         <block type="page/html_pager" name="new_products_toolbar_pager"/>
      </block>
   </block>
</reference>
  1. Update your template: In app/design/frontend/your_theme/template/catalog/product/list.phtml, you can now use the new block:
<?php
$products = $this->getNewProducts();
foreach ($products as $_product) {
    // Your product rendering logic here...
}
?>

Final Touches

Don’t forget to clear your Magento cache and refresh your homepage. You should now see a list of all the newest products across your store right on your homepage!

Remember, proper pagination is already handled by the catalog/product_list_toolbar.phtml template we included in our layout update.

Conclusion: Displaying New Products Made Easy

By following these steps, you’ve successfully implemented a feature that drives customer interest and improves the user experience of your Magento store. This custom approach allows you to showcase all your latest products without being restricted to specific categories.

If you found this guide helpful, make sure to explore more advanced tips and tricks on our Magento Development Blog. We cover everything from performance optimization to complex extension development. Happy coding!

Catalog Themes Customers Import/Export

Our network