Dear my friends,

Today I’ll write about the breadcrumbs. I’ll explain how to add breadcrumbs to your custom module (Due to default settings, your custom module doesn’t contain a breadcrumbs).

We will add links to breadcrumbs block of Magento.

Open the block that you want to add breadcrumbs then find function

public function _prepareLayout()

Then change it to:


public function _prepareLayout()
{
	$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
	$breadcrumbs->addCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
	$breadcrumbs->addCrumb('an_alias', array('label'=>'Your label', 'title'=>'Your title', 'link'=>Mage::getUrl("your_module/your_block")));

	return parent::_prepareLayout();
}

Refresh your page and you can see the breadcrumbs like this: home/your label

Author

Why Magestore? We believe in building a meaningful & long-term relationship with you.

4 Comments

  1. Dagny Toelle Reply

    I like your site. It’s really simple and cool without no much of put ups. I am also going to design my site simple and nice as yours

  2. carbon fiber hoods Reply

    Which block do I edit in order to have a “Home” link added to my bread crumb trail.

Write A Comment