In this article we will review how to output a new product on a home page using XML layout in any of Gomage templates. First of all, you should go to CMS > Pages > Home Page and choose Design tab. Then, you should add the following code into ‘Layout Update XML’ field that will allow you add the content blocks to the home page:
<reference name="content"> </reference>
Between ‘reference’ tags you should insert the code of new product blocks:
<block type="catalog/product_new" name="product_new" template="catalog/product/list.phtml "></block>
The next step is selecting the number of columns. This can be done through the following code which should be added between ‘block’ tags:
Then, you should set the number of products that will be displayed in the new products block:
The complete XML layout will 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>
If it is necessary to display products of a certain category you should add the following code:
Here, it is important to make sure that correct category ID is set. You can verify the ID in your admin panel at Catalog > Manage categories.
Please follow our updates and you will learn other possibilities of Magento stores optimizations in the articles in our blog.