I am trying to move the breadcrumbs to inside a category page, and Ive been struggling. I have been looking at the following resources, but they have not helped:
I have added the following to remove the breadcrumbs from
root and then add them as a child of
category.products. Like so:
<catalog_category_layered translate="label"> <reference name="root"> <remove name="breadcrumbs"/> </reference> <reference name="category.products"> <block type="page/html_breadcrumbs" name="onlybreadcrumbs" as="onlybreadcrumbs" template="page/html/breadcrumbs.phtml"/> </reference> </catalog_category_layered>
This is at the top of catalog/category/view.phtml I am adding the breadcrumbs file with this:
<?php echo $this->getLayout()->getBlock('onlybreadcrumbs')->toHtml(); ?>
At the top of page/html/breadcrumbs.phtml I have this:
<pre>Crumbs:<?php var_dump($crumbs); ?></pre>
The output at the top of a category pages is this:
My problem here is that after moving the breadcrumbs into the category view file, the
$crumbs variable is
NULL, and as a result none of the breadcrumbs appear.
In the end I used code from this page to get around the problem: http://awebtech.blogspot.co.uk/2011/04/magento-add-breadcrumbs-in-pages-where.html
However this solution is basically to just rebuild the breadcrumbs from scratch, and it feels like a bit of a hack.
Can someone explain to me, after moving the breadcrumbs into another file, why
$crumbs is now
NULL - and most importantly, how to fix this issue properly.