We are doing custom Magento themes, Magento design, custom Magento extensions and creative services through Magento designers & developers for worldwide shop owners.

Last News
Magento adding breadcrumb anywhere Programmatically

Magento adding breadcrumb anywhere Programmatically

Magento developers can add breadcrumb anywhere , example For example, I added a page and want to make them more clarity and arrangement by adding breadcrumbs .
There are several ways :
go to any exist layout.xml add inside the big parent tag :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<reference name="breadcrumbs">
            <action method="addCrumb">
                <crumbName>Homepage</crumbName>
                <crumbInfo>
                    <label>Home Page</label>
                    <title>Home Page</title>
                    <link>/home</link>
                </crumbInfo>
            </action>
            <action method="addCrumb">
                <crumbName>about</crumbName>
                <crumbInfo>
                    <label>About</label>
                    <title>About</title>
                </crumbInfo>
            </action>
        </reference>

for translate : and play inside your_module.csv
or inside controller :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
$breadcrumbs->addCrumb(
'home',
 array(
'label'=>$this->__('Home Page'),
'title'=>$this->__('Home Page'),
'link'=>Mage::getBaseUrl()
)
);
// add second item without link
$breadcrumbs->addCrumb(
'brands',
 array(
'label'=>$this->__('Private Account'),
'title'=>$this->__('Private Account')
)
);

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*