I’m trying to get Mage_Catalog_Block_Product_View_Type_Configurable (catalog/product/view/type/configurable.phtml) to work on the home page the same way it works on the product page for a configurable product but I’m getting “Fatal error: Call to a member function getTypeInstance() on a non-object in /server/path/to/app/code/core/Mage/Catalog/Block/Product/View/Abstract.php on line 38”.
I’m displaying a “Featured” product on the homepage using code found elsewhere on this site and this works great so far.
This product, as are all our products, is a configurable product.
I need to display some information on the associated products and I have not been having any success so far.
Since catalog/product/view/type/configurable.phtml allows me to access necessary information via e.g.
, what I am attempting to do to get that functionality on the homepage at this time is to add the “catalog/product_view_type_configurable” block to the home page via the homepage CMS as such:
<!-- Feature Edition on Homepage -->
<block type="catalog/product_homepage" name="home.catalog.product.homepage" alias="product_homepage" template="catalog/product/homepage.phtml" before="cms_page">
<block type="catalog/product_view_type_configurable" name="product.info.configurable" as="product_type_data" template="catalog/product/view/type/configurable.phtml"/>
and in catalog/product/homepage.phtml I’m calling the block as per
<?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
<?php if ($i>1): continue; endif; ?>
<?php $i++; endforeach; ?>
<?php endif; ?>
This however throws the error above.
What am I doing wrong or is there an altogether better way to get at the individual attributes of the associated products?
Any insights highly appreciated.