Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Configurable Product Block on Home Page
 
QuattroPorte
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-03-08
 

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”.

To elaborate:
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.

$this->getAllowProducts()
, 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:
reference name="content">
<!-- 
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"/>
</
block>
etc......

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 
    
echo $this->getChildHtml('product_type_data')
?>
.
.
.
<?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.
Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top