Saturday 13 December 2014

Magento: How to Display a Single Product Instead of a Category on Home Page

Method 1:-

1.In admin panel,Go to CMS > Pages > Home page

2.Choose it and there will be 4 tabs on the left. Page Information, Content, Design and Meta Data. Choose “Content”
3.Now paste this code snippet to show products labeled as “new” on your front page:

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

Method 2:-

1.In admin panel,Go to CMS > Pages > Home page

2.Choose it and there will be 4 tabs on the left. Page Information, Content, Design and Meta Data. Choose “Design”

3.Now paste it in Layout update XML

<reference name=”content”>
<block type=”catalog/product_new” name=”home.catalog.product.new” alias=”product_homepage” template=”catalog/product/new.phtml”>
<action method=”setProductsCount”><count>8</count></action>
<action method=”addPriceBlockType”>
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</block>
</reference>


4.Click Save page at the top right.

(Note that you must have some new products in your catalog for anything to show when you do this. This doesn’t mean that you’ve recently added them; only products explicitly marked as new using “Set Product as New from Date” and “Set Product as New to Date” options in the “General” product information page in the admin tool will be shown.)

Now,Go to Catalog > Manage Products and choose the product which you want to show as a new product in front end.

=>In the General Tab on the right there will be 2 options at the bottom “Set Product as New from Date” & “Set Product as New to Date
=>Put in the desired timeline when your products are new(In Magento- 1 week if you update frequently and 1 month if you update rarely).

Note:Make sure that in your theme the “new.phtml” file is there.

Source: Codewebber

No comments:

Post a Comment