Showing posts with label Magento Breadcrumbs. Show all posts
Showing posts with label Magento Breadcrumbs. Show all posts

Thursday, 20 October 2016

How to add breadcrumbs on custom phtml page?

You can add breadcrumbs from your custom index controller action. Reference code is below.


<?php 

 
    public function IndexAction() {     
      $this->loadLayout();
      $this->getLayout()->getBlock("head")->setTitle($this->__("CB Magento Developer"));  /* add your page title */
            $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
      $breadcrumbs->addCrumb("home", array(
                "label" => $this->__("Home Page"),
                "title" => $this->__("Home Page"),
                "link"  => Mage::getBaseUrl()
           ));

      $breadcrumbs->addCrumb("magento_developer", array(       /* add css class */
                "label" => $this->__("Magento Developer"),
                "title" => $this->__("Magento Developer")
           ));

      $this->renderLayout();

    }


?>

Monday, 17 October 2016

How to add breadcrumbs in Magento.

You have add bredcum by two ways:



1. Via code (Add in a controller):


              $crumbs = Mage::app()->getLayout->getBlock('breadcrumbs');

           $crumbs->addCrumb('home', array(

'label' => 'Home',

'title' => 'Go to Home Page',

'link' => Mage::getUrl('')

));


2. Via Layout XML:


              <reference name="breadcrumbs">

                 <action method="addCrumb">

                     <crumbname>home</crumbname>  <!-- Class Name Which apply on li -->

                    <crumbinfo>

                         <label>Home</label>

                        <title>Go to Home Page</title>

                        <link>/</link>

                  </crumbinfo>

             </action>

            <action method="addCrumb">

 <crumbName>cb</crumbName>  <!-- Class Name Which apply on li -->

<crumbInfo>

<label>CB</label>

<title>CB</title>

</crumbInfo>

  </action>

</reference>