Magento dead end – Breadcrumbs

Citește postarea în română

Share on:

In one of my adventures in the Magento code. I’ve encountered the following problem: I had to add a link to the breadcrumb.

As the documentation is not so great, after a little debugging (not a lot), I’ve got in to the core Mage_Page_Block_Html_Breadcrumbs.

The method is quite self-explanatory: addCrumb($crumbName, $crumbInfo, $after = false). Since I was there, I took a look inside:

1function addCrumb($crumbName, $crumbInfo, $after = false)
2{
3  $this->_prepareArray($crumbInfo, array('label', 'title', 'link', 'first', 'last', 'readonly'));
4  if ((!isset($this->_crumbs[$crumbName])) || (!$this->_crumbs[$crumbName]['readonly'])) {
5    $this->_crumbs[$crumbName] = $crumbInfo;
6  }
7  return $this;
8}

What’s interesting is the $after parameter, as you can see, even though it has a default value, is not used anywhere. The rest work’s as expected, probably this is why people don’t complain so much about it.