Display Related products on product details page in Magento
As a magento developer, many times we had requirement to display related product on product details page. Actually it’s very easy to show related product by following few easy steps. First we will have to add products to a particular product as related product.
Screen shows product added as related product
Follow the below steps to display related products.
1. Open catalog.xml, found in
app/design/frontend/default/YOURTEMPLATE/layout/
2. In catalog.xml find the catalog_product_view section, around line 220. In the section, remove or comment out:
- <block type=“catalog/product_list_related” name=“catalog.product.related” before=“-” template=“catalog/product/list/related.phtml”/>
and replace with:
- <reference name=“content”>
- <block type=“catalog/product_view” name=“product.info” template=“catalog/product/view.phtml”>
- <block type=“catalog/product_list_related” name=“catalog.product.related” as=“related” template=“catalog/product/list/related.phtml”/>
- </block>
- </reference>
3. Now in your catalog/product/view.phtml you can print out the related products using
- <?php echo $this->getChildHtml(‘related’); ?>
To edit the look of that list, edit catalog/product/list/related.phtml
OR You can also try this code to display related products
- <?php echo $this->getChildHtml(‘catalog.product.related’) ?>
If that above code doesn’t work, you might also try:
- <?php echo $this->getLayout()->getBlock(‘catalog.product.related’)->toHtml()?>
Hope it will work for you!
Follow @phpzag



obviously like http://www.phpzag.com however you need to test the spelling on several of your posts. A number of them are rife with spelling problems and I to find it very troublesome to tell the reality nevertheless I’ll definitely come back again.
Very interesting information!Perfect just what I was looking for!