2

How to move breadcrumb of category list page into toolbar section of category list page.

I need to move the breadcrumb to toolbar or either left sidebar before the filters.

Is it possible to do like that? Please anyone suggest me. Below code i used to move breadcrumb.

<move element="breadcrumbs" destination="content" before="-" />

from above code i am able to move it before the toolbar, but i need to move it into side bar.

Like this i want it.enter image description here

7
  • Can you share a screenshot? Sep 25, 2018 at 9:39
  • yes, i have attached the screenshot. please check once Sep 25, 2018 at 10:32
  • Did you move your toolbar section to top of main content area? Sep 25, 2018 at 10:33
  • no, i used only above code to move breadcrumb Sep 25, 2018 at 10:53
  • Where it currently showing after your code? Sep 25, 2018 at 10:55

1 Answer 1

2

Copy the below file to your theme location:

vendor/magento/module-catalog/view/frontend/layout/catalog_category_view.xml

and replace the below block:

<block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
    <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
</block>

with:

<block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="Magento_Catalog::product/list/toolbar.phtml">
    <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs" before="-"/>
    <block class="Magento\Theme\Block\Html\Pager" name="product_list_toolbar_pager"/>
</block>

Copy the below file to your theme location:

vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml

and update the code with below:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

?>
<?php
/**
 * Product list toolbar
 *
 * @var $block \Magento\Catalog\Block\Product\ProductList\Toolbar
 */
use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
<?php if ($block->getCollection()->getSize()): ?>
    <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'>
        <?= $this->getChildHtml('breadcrumbs') ?>
        <?php if ($block->isExpanded()): ?>
            <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode.phtml')) ?>
        <?php endif; ?>

        <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/amount.phtml')) ?>

        <?= $block->getPagerHtml() ?>

        <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter.phtml')) ?>

        <?php if ($block->isExpanded()): ?>
            <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter.phtml')) ?>
        <?php endif; ?>
    </div>
<?php endif ?>

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.