Posts Tagged ‘Home page’

Magento – Get category name in a custom product list on homepage

In all magento store mostly we show any category products list at home page. for that purpose we use list.phtml file or any custom file to show product list at home page using following block:

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

This block only show products list on home page, but it don’t show category name.
For showing category name with that products list we need to add following code into list.phtml or any custom file you are using.

1. Go to app/design/frontend/default/your_theme/template/catalog/product and open list.phtml then paste following code :

<?php echo Mage::getModel('catalog/category')->load($this->getCategoryId())->getName(); ?>

2. Now relaod your store home page, you will see category name there.

3.Done.

Enjoy magento :)