0

I have created a custom product listing page and add toolbar in the custom layout,it throws an error

Call to a member function getSize() on null in /opt/lampp/htdocs/setec/vendor/magento/module-catalog/view/frontend/templates/product/list/toolbar.phtml on line 18

how can i solve this?? Custom page layout

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="sidebar.main">
    <block class="Magento\LayeredNavigation\Block\Navigation\Category" name="catalog.leftnav" before="-" template="layer/view.phtml">
        <block class="Magento\LayeredNavigation\Block\Navigation\State" name="catalog.navigation.state" as="state" />
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalog.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </block>
</referenceContainer>

<referenceContainer name="content">
    <block class="Pits\Theme\Block\Homepage\Categories" name="product_filter" template="Pits_Theme::homepage/product_list.phtml" />
    <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>
      <action method="setToolbarBlockName">
                    <argument name="name" xsi:type="string">product_list_toolbar</argument>
                </action>
</referenceContainer>
</page>
  • Have you modified the template? The object you're trying to use getSize() on seems to be empty. – Max Sep 25 '17 at 9:15
  • I am using default toolbar.phtml file – Divya Muralidharan Sep 26 '17 at 14:48
  • Add the whole module code. – zed Blackbeard Mar 7 at 6:24

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.