1

I try to display my breadcrumbs on a custom phtml file.

In a custom controller I have defined an indexAction. After calling http://my-shop.com/auctionlist my page is displayed.

Controller:

class MyNamespace_AuctionExtend_IndexController extends Mage_Core_Controller_Front_Action {
    public function indexAction() {
        $this->loadLayout();
        $block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'auctionlist',
            array('template' => 'auctionlist/auctionlist.phtml')
        );

        $this->getLayout()->getBlock('root')->setTemplate('page/2columns-right.phtml');
        $this->getLayout()->getBlock('content')->setTitle(Mage::helper('core')->__('Auktionsliste'))->append($block);
        $this->getLayout()->getBlock('head')->setTitle(Mage::helper('core')->__('Auktionsliste'));
        $this->_initLayoutMessages('core/session');
        $this->renderLayout();
    }
}

In my local.xml file I manage all breadcrumb definitions like:

<customer_account_login>
    <reference name="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo>
                <label>Home</label>
                <title>Home</title>
                <link>/</link>
            </crumbInfo>
        </action>
    </reference>
</customer_account_login>

How can I call my custom auctionlist file in the local.xml to display the breadcrumbs? This is what I try to get:

<auctionlist_index>
    <reference name="breadcrumbs">
        <action method="addCrumb">
            ...
        </action>
    </reference>
</auctionlist_index>

(I already tryed that but it doesnt work.)

4

You can set this from your controller action. Below is the reference code.

public function IndexAction() {      
  $this->loadLayout();
  $this->getLayout()->getBlock("head")->setTitle($this->__("Auktionsliste"));
        $breadcrumbs = $this->getLayout()->getBlock("breadcrumbs");
  $breadcrumbs->addCrumb("home", array(
            "label" => $this->__("Home Page"),
            "title" => $this->__("Home Page"),
            "link"  => Mage::getBaseUrl()
       ));

  $breadcrumbs->addCrumb("Auktionsliste", array(
            "label" => $this->__("Auktionsliste"),
            "title" => $this->__("Auktionsliste")
       ));

  $this->renderLayout(); 

}
1

By adding below code in phtml file you can set breadcumbs

$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('Custom', array('label' => 'Custom', 'title' => 'Custom'));
echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();
0

I did some research and find the answer.

If anyone runs into the same problem here is my solution:

At first credits goes to
https://stackoverflow.com/questions/8353369/how-can-i-define-block-for-my-magento-controller-in-layout-xml

auctionlist_index in my local.xml doesnt work because my module is not called, so i changed it to: auctionextend_index_index and my breadcrumbs are visible now.

0

Try this with add Custom Breadcrumbs Pages(Reference)

// get breadcrumbs object
// Magento Breadcrumbs Custom Pages
$_getbreadcrumbs = $this->getLayout()->getBlock('breadcrumbs');

$_getbreadcrumbs->addbreadCrumb('home', array('label'=>Mage::helper('cms')->__('Home'), 'title'=>Mage::helper('cms')->__('Home Page'), 'link'=>Mage::getBaseUrl()));

$_getbreadcrumbs->addbreadCrumb('country', array('label'=>'Country', 'title'=>'All Countries', 'link'=>'http:// onlinecode.org/magento/onlinecodeName/country'));

$_getbreadcrumbs->addbreadCrumb('manufacturer', array('label'=>'State', 'title'=>'States'));
// echo breadcrumbs data
echo $this->getLayout()->getBlock('breadcrumbs')->toHtml();

AND

<reference name="breadcrumbs">
    <action method="addbreadCrumb">
            <!-- First breadcrumbs name -->
            <name>Home</name>
            <!-- add label, title, link  -->
            <params><label>Home</label><title>Home</title><link>/</link></params>
    </action>
    <action method="addbreadCrumb">
            <!-- add authors  -->
            <name>authors</name>
            <!-- add label, title, link  -->                        
<params><label>Authors</label><title>Authors</title><link>/index.php/managingusers/index/authorlist</link></params>
    </action>
    <action method="addbreadCrumb">
            <!-- add searchlist  -->
            <name>searchlist</name>
            <!-- add label, title, link  -->    
            <params><label>Search List</label><title>SearchList</title><link /></params>
    </action>
</reference>

Reference :: Magento Breadcrumbs Custom Pages

0

app/design/frontend/{package}/{theme}/layout/local.xml

<your_layout_handle>
    <reference name="breadcrumbs">
        <action method="addCrumb">
            <name>Home</name>
            <params><label>Home</label><title>Home</title><link>/</link></params>
        </action>
        <action method="addCrumb">
            <name>New page</name>
            <params><label>newpage</label><title>newpage</title></params>
        </action>
    </reference>
</your_layout_handle>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.