show products on cms page under specified product id using "catalog/product/list.phtml" template

show products on cms page under specified product id using "catalog/product/list.phtml" template

October 3, 2026 · Illustrated author avatarBy Stefan Bogdanescu
show products on cms page under specified product id using "catalog/product/list.phtml" template

Embedding Products into Your CMS Page: A Developer’s Guide

Displaying products on your Content Management System (CMS) page is a fundamental aspect of e-commerce development. In Magento, this process involves using blocks and templates to dynamically populate product data into your pages.

Understanding the Current Approach

Currently, you have successfully implemented a method to display all products from category 12 using the catalog/product_list block type and the catalog/product/list.phtml template:

{{block type="catalog/product_list" category_id="12" template="catalog/product/list.phtml"}}

This code instructs Magento to create a new instance of the product list block, filter it by category ID 12, and render the output using the specified template.

Displaying Selected Products Based on Product IDs

Your question now revolves around listing specific products based on their individual IDs rather than via a category. Unfortunately, the built-in catalog/product_list block does not directly support this functionality out of the box.

However, you can achieve this by employing an alternative approach that involves creating a custom block extension:

  1. Create a new module: In your app/code/local/YourCompany/YourModule/etc/config.xml, define a new custom block under the <blocks> node.
<blocks>
    <yourmodule>
        <class>YourCompany_YourModule_Block</class>
    </yourmodule>
</blocks>
  1. Create your product list block: In the app/code/local/YourCompany/YourModule/Block directory, create a new file called ProductList.php. This will contain your custom product list block.
class YourCompany_YourModule_Block_ProductList extends Mage_Core_Block_Template
{
    public function getProducts()
    {
        $productIds = array("15", "88", "17");
        return Mage::getModel('catalog/product')->getCollection()->addIdFilter($productIds);
    }
}

This block defines a method getProducts() that retrieves an array of product IDs and returns the corresponding product collection.

  1. Call your custom block in the CMS page

Finally, you can call this new block from within your CMS page:

{{block type="yourmodule/product_list" template="catalog/product/list.phtml"}}

This will create an instance of YourCompany_YourModule_Block_ProductList and render its output using the same catalog/product/list.phtml template.

Conclusion

While Magento’s built-in blocks are powerful tools for managing product lists based on categories, they do not directly support filtering by specific product IDs. By creating a custom block extension as demonstrated above, you can achieve this functionality while keeping your codebase clean and organized.

Remember to clear your cache after implementing these changes.

For more in-depth guides on Magento development practices, including module creation and custom block development, I recommend exploring the resources available at Laravel Company.

The key is to leverage the flexibility of Magento’s block system while maintaining a structured approach to your code. Happy coding!

Catalog Extensions Themes Configuration

Our network