New products by category in Magento

New products by category in Magento

July 21, 2026 · Illustrated author avatarBy Stefan Bogdanescu
New products by category in Magento

Solving Magento Category Filter Issues for New Products

The Problem: Category Filter Not Working for New Product Block

You’re not alone if you’ve struggled to show new products by category in Magento. Many developers face the same challenge - the category filter seems broken when using the catalog/product_new block type.

The category_id parameter doesn’t seem to work, regardless of how you try to implement it:

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" category_id="74" template="catalog/product/new.phtml"}}

Or even when using the block without a specific name or alias:

{{block type="catalog/product_new" category_id="74" template="catalog/product/new.phtml"}}

It’s frustrating because you know that categories are properly set up - using list products works perfectly, showing only items from the specified category.

Understanding Why the Category Filter Fails

The issue lies in how Magento handles the catalog/product_new block. By default, it retrieves new products across all categories, ignoring any specific category_id you provide.

The block is designed to display new products throughout the entire store, not just within a single category. This makes sense for the homepage or other general-purpose layouts where you want to highlight new arrivals regardless of their category.

Solutions: How to Show New Products by Category

Method 1: Use Layered Navigation

Magento’s layered navigation feature allows you to filter products by category on the front-end. If your theme supports it, enable layered navigation for the specific category page where you want to show new products.

Layered navigation automatically filters the product collection based on the current category context. You don’t need to modify any block types or templates; Magento handles this filtering internally.

Method 2: Create a Custom Product Collection

If your theme doesn’t support layered navigation, you can create a custom product collection using Magento’s API. This method requires some PHP programming knowledge.

Here’s an example of how to retrieve new products for a specific category:

// Get the current category id from the request
$categoryId = Mage::registry('current_category')->getId();

// Create a new product collection
$collection = Mage::getModel('catalog/product')
    ->getCollection()
    ->addAttributeToSelect('*');

// Filter by category and status (enabled)
$collection->joinField(
    'category_id',
    'catalog/category_product',
    'category_id',
    'product_id=entity_id',
    null,
    'left'
)->addAttributeToFilter('category_id', array('eq' => $categoryId))
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

// Sort by date and limit to new products
$collection->setOrder('created_at', 'DESC')->setPageSize(12);

Method 3: Use a Custom Block Type

If you prefer working with XML layouts, you can create a custom block type that inherits from catalog/product_new. Override the collection initialization logic in your custom block to filter by category.

For example, define a new block type and template:

<blocks>
    <new_products_by_category>
        <class>NewProductsByCategory</class>
        <type>catalog/product_new</type>
        <template>yourtheme/new.phtml</template>
    </new_products_by_category>
</blocks>

Then, create a PHP file for your custom block:

class NewProductsByCategory extends Mage_Catalog_Block_Product_New {
    public function getLoadedProductCollection() {
        $collection = parent::getLoadedProductCollection();

        // Get the current category id from the request
        $categoryId = Mage::registry('current_category')->getId();

        // Filter by category and status (enabled)
        $collection->joinField(
            'category_id',
            'catalog/category_product',
            'category_id',
            'product_id=entity_id',
            null,
            'left'
        )->addAttributeToFilter('category_id', array('eq' => $categoryId))
        ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);

        // Sort by date and limit to new products
        $collection->setOrder('created_at', 'DESC')->setPageSize(12);

        return $collection;
    }
}

Conclusion: Displaying New Products by Category

In Magento, displaying new products within a specific category isn’t as straightforward as using the built-in catalog/product_new block. The default behavior retrieves all new products across categories.

To solve this issue:

  • Use layered navigation if your theme supports it.
  • Create a custom product collection in PHP for more control.
  • Develop a custom block type that filters by category when loading the product collection.

Remember, each method has its pros and cons depending on your specific use case. Layered navigation is user-friendly but requires a supportive theme layout. Custom collections are flexible but need programming knowledge.

In any case, understanding how Magento’s core functionality works can help you tailor your e-commerce platform to meet your store’s unique requirements.

For more insights into Magento development best practices and custom solutions, visit https://laravelcompany.com/blog.

Catalog Themes Errors

Our network