Skip to main content

function Function displaying the number of found products in layered navigation filters in magento2Magento2

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) iI need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how iI have overridden filter.phtml in my

  code \Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

di.xml

<preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" type="Vendor\LayeredNavigation\Block\Navigation\FilterRenderer" />

function displaying the number of found products in layered navigation filters in magento2

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) i need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how i have overridden filter.phtml in my

 \Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

di.xml

<preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" type="Vendor\LayeredNavigation\Block\Navigation\FilterRenderer" />

Function displaying the number of found products in layered navigation filters in Magento2

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) I need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how I have overridden filter.phtml in my code \Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

di.xml

<preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" type="Vendor\LayeredNavigation\Block\Navigation\FilterRenderer" />
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
answer updated
Source Link
Sushivam
  • 2.6k
  • 3
  • 36
  • 88

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) i need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how i have overridden filter.phtml in my

\Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

di.xml

<preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" type="Vendor\LayeredNavigation\Block\Navigation\FilterRenderer" />

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) i need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how i have overridden filter.phtml in my

\Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

Which function is responsible for displaying the total count of products in the filters in the layered navigation.

ie) i need to get the count (eg 50 ) in my custom filterable attributes as well.

enter image description here

This is how i have overridden filter.phtml in my

\Vendor\LayeredNavigation\view\frontend\layout\catalogsearch_result_index.xml

<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock class="Vendor\LayeredNavigation\Block\Navigation" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_LayeredNavigation::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    
    <referenceContainer name="content">
        <block class="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" name="catalogsearch.navigation.renderer" as="renderer" template="layer/filter.phtml"/>
    </referenceContainer>
</body>

di.xml

<preference for="Magento\LayeredNavigation\Block\Navigation\FilterRenderer" type="Vendor\LayeredNavigation\Block\Navigation\FilterRenderer" />
answer updated
Source Link
Sushivam
  • 2.6k
  • 3
  • 36
  • 88
Loading
Source Link
Sushivam
  • 2.6k
  • 3
  • 36
  • 88
Loading