Domanda

I want to display the breadcrumbs in list page alone to display inside the grid exactly just above the toolbar.

So I entered this line of code:

<?php echo $this->getChildHtml('breadcrumbs') ?>

just above the line :

<?php echo $this->getToolbarHtml() ?>

in app/design/frontend/<package>/<theme>/template/catalog/list.phtml.

But nothing is getting displayed.

I want to change the position of breadcrumbs only in list page. Why the above procedure not working. Is there anything wrong to use getChildHtml() to call block like this?

È stato utile?

Soluzione

getChildHtml() method only works if there's a corresponding child in the current block.

However, natively Magento breadcrumbs is not a child of the product list, that's why your code is not working.

To do so, you will have to edit/create app/design/frontend/<package>/<theme>/layout/local.xml with the following code:

<catalog_category_default>
    <action block="root" method="unsetChild"><name>breadcrumbs</name></action>
    <action block="product_list" method="insert"><name>breadcrumbs</name></action>
</catalog_category_default>

<catalog_category_layered>
    <action block="root" method="unsetChild"><name>breadcrumbs</name></action>
    <action block="product_list" method="insert"><name>breadcrumbs</name></action>
</catalog_category_layered>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top