Help with Magento and related products

Posted by Anthony on Stack Overflow See other posts from Stack Overflow or by Anthony
Published on 2011-01-07T05:27:14Z Indexed on 2011/01/07 6:53 UTC
Read the original article Hit count: 189

Filed under:
|

I have a customer product page that literally lives beside the catalog/product/view.phtml page. It's basically identical to that page with a few small exceptions. It's basically a 'product of the day' type page so I can't combine it with the regular product page since I have to fetch the data from the DB and perform a load to get the product information

$_product = Mage::getModel('catalog/product')->load($row['productid']);

To make a long story short, everything works (including all children html blocks) with the singular exception of the related products.

After the load I save the product into the registry with

Mage::register('product', $_product); 

and then attempt to load the related products with:

echo $this->getLayout()->createBlock('catalog/product_view')->setTemplate('catalog/product/list/related.phtml')->toHtml();`

All of which give back the error:

Fatal error: Call to a member function getSize() on a non-object in catalog/product/list/related.phtml on line 29`, 

and line 29 is

<?php if($this->getItems()->getSize()): ?>`.

Any help getting the relateds to load would be appreicated.

© Stack Overflow or respective owner

Related posts about magento

Related posts about magento-enterprise