Reputation: 1783
This is the line I have put in catalog/product/view.phtml:
<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>
And this is the error I get:
Fatal error: Call to a member function toHtml() on a non-object in ../catalog/product/view.phtml on line 159
Any solutions to this? I am running Magento 1.4.1.1
Upvotes: 1
Views: 9136
Reputation: 5640
I had this same quandary. I managed to get breadcrumbs on the products page by adding the following to app/design/frontend/THEME/default/layout/calalog.xml
<catalog_product_view translate="label">
<-- existing content -->
<reference name="content">
<-- existing blocks -->
<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
<-- existing blocks -->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</block>
</reference>
<-- existing content -->
</catalog_product_view>
Then in catalog/product/view.phtml add the following where you would like the breadcrumbs to appear.
<?php echo $this->getChildHtml('breadcrumbs') ?>
Upvotes: 0
Reputation: 7715
XML
Make sure you have your configuration setup in your theme's page.xml
<block reference="header">
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</block>
View
You need to call the HTML item itself
<?php echo $this->getChildHtml('breadcrumbs') ?>
Upvotes: 1