As title I like to move my product name inside breadcrumbs.phtml. the following are the codes I currently have. But it returns a "Fatal error: Call to a member function getName() on a non-object". how can we fix this?
<?php if($crumbs && is_array($crumbs)): ?>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<div class="breadcrumbs">
<div class="container">
<div class="container-inner">
<ul>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>">
<?php if($_crumbInfo['link']): ?>
<a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->escapeHtml($_crumbInfo['title']) ?>"><?php echo $this->escapeHtml($_crumbInfo['label']) ?></a>
<?php elseif($_crumbInfo['last']): ?>
<strong><?php echo $this->escapeHtml($_crumbInfo['label']) ?></strong>
<?php else: ?>
<?php echo $this->escapeHtml($_crumbInfo['label']) ?>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<span><i class="fa fa-angle-right"></i> </span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<div>
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
</div>
</div>
</div>
</div>
<?php endif; ?>