0

I am building a custom module and I need to show the Layered Navigation inside the product listing toolbar. Can you please help on this here is my catalog_category_view.xml file

    <?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block class="Magento\Catalog\Block\Product\ProductList\Toolbar" name="product_list_toolbar" template="George_CategoryNav::product/list/toolbar.phtml">

            </block>
        </referenceContainer>
        <move element="catalog.leftnav" destination="product_list_toolbar" before="-"/>
    </body>
</page>

and here is my toolbar.phtml file

    <?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;
use Magento\LayeredNavigation\Block\Navigation;
?>
<?php if ($block->getCollection()->getSize()): ?>
    <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'>
        <div class="popup-button-wraper">
            <?php echo $this->getChildHtml('catalog.leftnav') ?>
        </div>
        <?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 ?>
  • Can you post your whole code as above code looks fine. – Sukumar Gorai Sep 12 at 15:23
  • @SukumarGorai This is the two file that required all other is registration and module.xml file – GeorgeM Sep 12 at 15:49
-1

Try with below code

<move element="catalog.leftnav" destination="category.product.list.additional" before="-"/>
  • @ Narayan Jat- I tried this before but it move the Layered Navigation below the toolbar, I need to move inside the toolbar – GeorgeM Sep 12 at 15:38

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.