voodish logo
tweet rss book of faces Linked In

Related products on product page in Magento

Move related products from default sidebar location into main product page in Magento.

1. Open catalog.xml, found in
app/design/frontend/default/YOURTEMPLATEFOLDER/layout/

2. In catalog.xml find the catalog_product_view section, around line 205. 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

DEMO

This demo shows a 1 column design with the related products down the right handside in a Horizontal Carousel. View Demo

Related Articles

Comments RSS Feed

26 Comments

  1. amit soni July 29, 2010

    it doesnot work for me.I did same opertions as told by you.Can you figure out why

  2. Go to Top of the page

  3. admin July 29, 2010

    Which version of Magento are you using? This was tried and tested on 1.4x

    Are you receiving any Magento errors messages?
    Also, take a look through your server logs and let me know.

    If you still can’t get it to work then send me a mail, using the contact form, and I’ll get it working for you.

  4. Go to Top of the page

  5. mahesh March 24, 2011

    It is not working for me also, not outputting anything, from where to upload realted products? i uploade from catlog->manage products->edit->related product

  6. Go to Top of the page

  7. admin March 24, 2011

    ok guys, will do some checks… are you using 1.4x?

  8. Go to Top of the page

  9. admin March 24, 2011

    Are you definitely using the 1 column layout for this?

  10. Go to Top of the page

  11. admin March 24, 2011

    I’ve sent you an email, I would like to try and get to the bottom of this, as it works fine for me. Can you supply me with access so that I can check for you?

  12. Go to Top of the page

  13. mahesh March 25, 2011

    I got solution for my problem, its working now…thank u

  14. Go to Top of the page

  15. admin March 25, 2011

    @mahesh, when you get a moment, could you let everyone know what the problem was?… was there anything missing from the explanation above?

  16. Go to Top of the page

  17. Mahesh March 25, 2011

    Hi - The file name related.phtml was changed to view-related.phtml by my coligue. When i follow the instructions above properly, it starts working….
    thanks for the help.

  18. Go to Top of the page

  19. arek March 29, 2011

    is there any chance you know how to apply this solution in magento 1.5 in a 2 column left layout?

  20. Go to Top of the page

  21. Ravi Pathak April 16, 2011

    I am quite curious as to how magento derives related products to be displayed. I understand that @Mahesh solved this problem , however, I am not sure if the related products are shown scientifically & automatically(i.e. without any manual settings).

  22. Go to Top of the page

  23. Raju May 4, 2011

    Hi
    This worked for me thanks.
    Please check you are declaring the block at right place in xml file.

  24. Go to Top of the page

  25. Damo May 27, 2011

    Hi,
    Great article on moving the related products block to the middle column thanks - how would I get this to work with the hellowired theme and show as a tab? I have upsell on a tab in catalgoue.xml like this…
    upsell_productsAlternativescatalog/product_list_upsellcatalog/product/list/upsell.phtml

  26. Go to Top of the page

  27. Damo May 27, 2011

    upsell_products Alternatives catalog/product_list_upsellcatalog/product/list/upsell.phtml

  28. Go to Top of the page

  29. selepok October 7, 2011

    Thank you very much!

  30. Go to Top of the page

  31. spawn December 7, 2011

    Thanks for this post. Works on magento 1.5

    Helps a lot, thank you so much. :)

  32. Go to Top of the page

  33. Wendy May 1, 2012

    Hi, I used the above code. It works fine,thanks, but the block appears at the bottom of the product page and I would like it to show above “upsell products”.
    In view.phtml I copied the link getChildHtml(’related’); ?> before getChildHtml(’upsell_products’); ?>. Why does it show up at the bottom? I use magento 1.5.1.
    Please advice, thanks.

  34. Go to Top of the page

  35. Nima Heydarian May 3, 2012

    Thanks a bunch friend. It worked like a charm.

  36. Go to Top of the page

  37. laeeq June 1, 2012

    really usefull, this worked for me thanks.

  38. Go to Top of the page

  39. Bruce007 June 5, 2012

    guys it seem like a great idea and that is exactly what im looking for but after making all the changes recommended avowed it only duplicated the product info and nothing else. in another words did not work i have magento 1.7 can anyone help please..

  40. Go to Top of the page

  41. Kiran July 6, 2012

    I followed the steps given above, but on my view.phtml i am not able to see the product image and add to cart button. if i remove catalog.xml file the it appeares. please help what to do to resolve this issue. Thanks…

  42. Go to Top of the page

  43. whiteb0x July 13, 2012

    This works, but it wipes all my other html out on my product page! :(

  44. Go to Top of the page

  45. Jessica August 6, 2012

    Bruce007, I have the exact same issue, did you find any resolve?

  46. Go to Top of the page

  47. Kamesh Jungi August 16, 2012

    ou can do the following (inside the foreach loop)

    $related_product_collection = $_product->getRelatedProductCollection();
    $related_product_collection->AddStoreFilter();
    Regards, Kenny

    PS: If you want to know which methods are available, you can always run the

    var_dump(get_class_methods($_product)); die;
    //or
    Mage::log(print_r(get_class_methods($_product),true));

  48. Go to Top of the page

  49. sam September 13, 2012

    cheers, perfect solution

  50. Go to Top of the page

  51. Paul August 1, 2013

    It is not working for me. The product is displaying 2 times on view page. I am using 1.7 version

  52. Go to Top of the page

Leave a comment