>> Here's a easy solution to add breadcrumb to any page. In core block page find _prepareLayout() method.
<?php
public function _prepareLayout()
{
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
$breadcrumbs->addCrumb('home', array('label'=>Mage::helper('vendor')->__('GEAR WAREHOUSE'),
'title'=>Mage::helper('vendor')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
$breadcrumbs->addCrumb('my_account', array('label'=>Mage::helper('vendor')->__('My Account'),
'title'=>Mage::helper('vendor')->__('My Account'), 'link'=>Mage::getBaseUrl().'customer/account'));
$breadcrumbs->addCrumb('my_classified', array('label'=>Mage::helper('vendor')->__('Classified'),
'title'=>Mage::helper('vendor')->__('My Classified'), 'link'=>Mage::getBaseUrl().'vendor'));
$breadcrumbs->addCrumb('an_alias', array('label'=>'Edit',
'title'=>'Edit Classified', 'link'=>''));
}
?>
By using addCrumb() method you can set your breadcrumb to any page. In your phtml page you've to write the following code :
<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>
By default this code is written in layout page. (e.g. 1column.phtml)
<?php
public function _prepareLayout()
{
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
$breadcrumbs->addCrumb('home', array('label'=>Mage::helper('vendor')->__('GEAR WAREHOUSE'),
'title'=>Mage::helper('vendor')->__('Home Page'), 'link'=>Mage::getBaseUrl()));
$breadcrumbs->addCrumb('my_account', array('label'=>Mage::helper('vendor')->__('My Account'),
'title'=>Mage::helper('vendor')->__('My Account'), 'link'=>Mage::getBaseUrl().'customer/account'));
$breadcrumbs->addCrumb('my_classified', array('label'=>Mage::helper('vendor')->__('Classified'),
'title'=>Mage::helper('vendor')->__('My Classified'), 'link'=>Mage::getBaseUrl().'vendor'));
$breadcrumbs->addCrumb('an_alias', array('label'=>'Edit',
'title'=>'Edit Classified', 'link'=>''));
}
?>
By using addCrumb() method you can set your breadcrumb to any page. In your phtml page you've to write the following code :
<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>
By default this code is written in layout page. (e.g. 1column.phtml)
No comments:
Post a Comment