Categories

Featured templates

Magento. Display new products on the home page (XML)

Chris Diaz June 23, 2011
Rating: 4.3/5. From 3 votes.
Please wait...

This tutorial will show you how to display new products on the home page using the XML layout update.

Open Magento admin panel. Go to CMS>Pages>Home Page.  Switch to the Design tab. Into the Layout Update XML window paste the following code:

 

1. First of all create the content reference:

  <reference  name="content">
</reference>

This will let you put the blocks into the home page content area.

 

2. Insert the new products block:

  <block  type="catalog/product_new" name="product_new"  template="catalog/product/list.phtml">
</block>

The block code should be inserted into the reference tag.

 

3. Set the number of the product columns in the new products listing:

<action  method="setColumnCount"><column_count>6</column_count></action>

The action code should be inserted into the block  tag.

 

4. Set the amount of products displayed in the new products block:

<action  method="setProductsCount"><count>0</count></action>

As a result your XML code should look like this:

  <reference  name="content">
<block type="catalog/product_new" name="product_new" template="catalog/product/list.phtml">
<action method="setColumnCount"><column_count>6</column_count></action>
<action method="setProductsCount"><count>0</count></action>
</block>
</reference>

 

In case you want to display the new products from the specific category use the following action:

  <action  method="setCategoryId"><category_id>10</category_id></action>

Make sure you set the correct category ID value. You can get the category ID from the admin panel>Catalog>Manage categories.

 

We recommend clear and disable the Magento cache when editing the static pages.

Templates for Magento
This entry was posted in Magento Tutorials and tagged home, layout, listing, Magento, page, product, XML. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket