0

I'm trying to create a custom category bottom toolbar without the h1 title. I've done the following.

Created a module with the following structure

/app/code/Vendor/ToolbarBottom

/app/code/Vendor/ToolbarBottom/view/frontend/templates/product/list/toolbarbottom.phtml

With the following code

<?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
$list_count = $this->helper('Ecomwares\Wokiee\Helper\Data')->getSystemValue('wokiee_settings/product_listing/list_count');
?>

<?php if ($block->getCollection()->getSize()): ?>
    <div class="toolbar toolbar-products" data-mage-init='<?= /* @escapeNotVerified */ $block->getWidgetOptionsJson() ?>'>
        <div class="tt-filters-options">

            <?php echo $block->getChildHtml('category.description'); ?>
            <div class="tt-btn-toggle">
                <a href="#"><?= /* @escapeNotVerified */ __('Filter') ?></a>
            </div>
            <div class="tt-sort">
                <?php if ($block->isExpanded()): ?>
                    <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/sorter_custom.phtml')) ?>
                <?php endif; ?>
                <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/limiter_custom.phtml')) ?>
            </div>
            <?php if ($block->isExpanded()): ?>
                <?php include ($block->getTemplateFile('Magento_Catalog::product/list/toolbar/viewmode_custom.phtml')) ?>
            <?php endif; ?>
        </div>
        <?= $block->getPagerHtml() ?>
    </div>

<?php endif ?>

/app/code/Vendor/ToolbarBottom/Block/Product/ProductList/Toolbar.php

Toolbar.php has the same code as

\Magento\Catalog\Block\Product\ProductList\Toolbar

Then updated the design file as follows.

app/design/frontend/Vendor/vendor_child/Magento_Catalog/templates/product/list.phtml

from

<div class="bottom-toolbar">
        <?= $block->getToolbarHtml() ?>
    </div>

to

<div class="bottom-toolbar">
        <?= $block->getToolbarBottomHtml() ?>
    </div>

Ran upgrade and flushed cache, the category page loads fine but now without the bottom toolbar, any ideas what I may be doing wrong. Thanks in advance.

2
  • have you create the xml file and set your template from that one? Sep 21 at 9:23
  • No, I'm not sure what I'm supposed to do for that. Sep 21 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.