datasn.io
datasn.io

Reputation: 12867

Set breadcrumb for one of the pages of Magento?

I have this page for instance that doesn't have a proper breadcrumb set: http://www.princessly.com/checkout/cart/

It's just "Home >>" and that's it.

How can I make it "Home >> Shopping Cart"?

Thus far I can only find the breadcrumb template which is template/page/html/breadcrumbs.phtml but I have no idea how to make this change.

I suppose I should add a line in the shopping cart page template?

Upvotes: 4

Views: 6225

Answers (2)

Agustincl
Agustincl

Reputation: 174

For some reason sometimes we need to touch the template on code>page>html>breadcrumbs.phtml. Just remember to move before to your template.

<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul>
    <?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
        <li class="<?php echo $_crumbName ?>">
        <?php if($_crumbInfo['link']): ?>
            <a href="<?php echo $_crumbInfo['link'] ?>" title="<?php echo $this->__($this->htmlEscape($_crumbInfo['title'])) ?>"><?php echo $this->__($this->htmlEscape($_crumbInfo['label'])) ?></a>
        <?php elseif($_crumbInfo['last']): ?>
            <strong><?php echo $this->__($this->htmlEscape($_crumbInfo['label'])) ?></strong>
        <?php else: ?>
            <?php echo $this->__($this->htmlEscape($_crumbInfo['label'])) ?>
        <?php endif; ?>
        <?php if(!$_crumbInfo['last']): ?>
            <span>/ </span>
        <?php endif; ?>
        </li>
    <?php endforeach; ?>
</ul>
</div>
<?php endif; ?>

The translate is performed by

$this->__("someText");

Upvotes: 0

Tim Bezhashvyly
Tim Bezhashvyly

Reputation: 9100

Try adding the following code to local.xml of your theme:

<checkout_cart_index>
    <reference name="breadcrumbs">
        <action method="addCrumb">
            <crumbName>Home</crumbName>
            <crumbInfo><label>Home</label><title>Home</title><link>/home</link></crumbInfo>
        </action>
        <action method="addCrumb">
            <crumbName>Shopping Cart</crumbName>
            <crumbInfo><label>Shopping Cart</label><title>Shopping Cart</title><link>/checkout/cart</link></crumbInfo>
        </action>
    </reference>
</checkout_cart_index>

Upvotes: 10

Related Questions