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 :)

Comments

Rantax 06-07-2012, 23:39

Wonderful goods from you, man. I’ve keep in mind your stuff prior to and you are simply extlmeery excellent. I actually like what you’ve obtained right here, certainly like what you’re saying and the way in which in which you are saying it. You’re making it enjoyable and you still take care of to stay it wise. I can not wait to read much more from you. This is really a terrific site.

Reply
Mike 18-12-2012, 00:37

Awesome, thank you! I tried about a dozen other solutions suggested on the Magento forums, and this is the only one that worked correctly for me.

Reply
dentist arlington 14-04-2013, 07:52

I am sure this post has touched all the internet viewers, its
really really nice paragraph on building up new web site.

Reply

Leave a Reply



+ three = nine