4

In my site, the breadcrumbs are not displaying on the Contacts page. I have added the code for breadcrumbs in contacts.xml (given below), but still not working.

<layout version="0.1.0">
<contacts_index_index translate="label">
    <label>Contact Us Form</label>

    <reference name="head">
        <action method="setTitle" translate="title" module="contacts">
            <title>Contact Us</title>
        </action>
    </reference>
    <reference name="breadcrumbs" as="breadcrumbs">
        <action method="addCrumb">
            <crumbName>home</crumbName>
            <crumbInfo>
                <label>Home</label>
                <title>Home</title>
                <link>/</link>
            </crumbInfo>
        </action> 
        <action method="addCrumb">
            <crumbName>contacts</crumbName>
            <crumbInfo>
                <label>Contact us</label>
                <title>Contact us</title>
            </crumbInfo>
        </action>
    </reference>
    <reference name="root">
        <action method="setTemplate">
            <template>page/2columns-left.phtml</template>
        </action>
        <action method="setHeaderTitle" translate="title" module="contacts">
            <title>Contact Us</title>
        </action>
    </reference>
    <update handle="cms_menu"/>
    <reference name="content">
        <block type="core/template" name="contactForm" template="contacts/form.phtml"/>
    </reference>
</contacts_index_index>

2 Answers 2

0

Your code should work if breadcrumb <?php echo $this->getChildHtml('breadcrumbs') ?> have been called at 2columns-left.phtml.

Or you have not removed breadcrumbs from layout xml files.

A short solution is:

<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>
0

You can add below code in contact

<reference name="root">
  <action method="unsetChild"><alias>breadcrumbs</alias></action>
  <block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs">
    <action method="addCrumb">
      <crumbName>home</crumbName>
      <crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
    </action> 
    <action method="addCrumb">
      <crumbName>contacts</crumbName>
      <crumbInfo><label>Contact us</label><title>Contact us</title></crumbInfo>
    </action>
  </block>
</reference>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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