I want to show some related product in magento theme. For that I updated catalog.xml file with following code.

<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"/>

And added below code in catalog/product/view.phtml file.

<?php echo $this->getChildHtml('related'); ?>

After this few changes I got this error

 Fatal error: Call to a member function addToChildGroup() on a non-object in magento/app/code/core/Mage/Core/Block/Abstract.php on line 815

Please suggest what could be the issue of this error.

  • on which file this is show the error – Amit Bera Oct 30 '14 at 11:14
  • It shows on product detail page – Harish Kumar Oct 30 '14 at 11:19
  • Please post the full catalog.xml catalog_product_view section and any snippets from other layout xml files like a custom theme one that might influence this. My guess is somewhere the reference is being added to a parent group. Have you tried using another name or as for the block? – Sander Mangel Apr 14 '15 at 6:45

Try using the following snippet for the related block xml it appears you are missing some information that this block needs.

<block type="catalog/product_list_related" name="catalog.product.related" as="related" after="product.info.upsell" template="catalog/product/list/related.phtml">
  <action method="setColumnCount">
  <action method="setItemLimit">
  • Thanks for the code, But this also not worked.. – Harish Kumar Oct 31 '14 at 5:50

Please use the following code

<?php echo $this->getChildHtml('catalog.product.related'); ?>

in place of

<?php echo $this->getChildHtml('related'); ?>
  • I did not agree with your solution because I am using as="related" in xml, so both option will work. There is another issue in my code. Which I am not able to figure out. – Harish Kumar Oct 31 '14 at 5:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.