Jump to content

Count manufacturer products in product list


ruisonika

Recommended Posts

Hello guys,

I some lights/help for doing this task:
I've listed the brands on left column and in the center column i have products, and i need to show the number of products of that brand (that are showed in center column).
As you can see in my image there are total 6 products (4 of HP and 2 of TEXNATURA), my goal is to achive HP (4) and TEXTNATURA (2)...
And this can be done by javascript only (i think), this is my code to render left column.
 

<div class="sidebar col-xs-12 col-sm-12 col-md-3 col-lg-3 offcanvas-sidebar">
    <div id="filtrosPesquisaTinteiros" class="row rui">
        <div class="col-xs-12">
            <p class="page-subheading ">BRANDS</p>
        </div>
        <div class="col-xs-12 ">
            <div id="myBtnContainer" style="display: inline-grid;width:100%;">
                <specialbtn class="active" onclick="filterSelection('all')"><speciali class="fa fa-check-square" aria-hidden="true"></speciali><span>SEE ALL</span><span class="count">{$products|@count}</span></specialbtn>
                {foreach from=$products item=product name=products key=index}
                    <specialbtn class="btn_{$product.id_manufacturer}" onclick="filterSelection('{$product.id_manufacturer}')"><speciali class="fa fa-square-o" aria-hidden="true"></speciali><span>{Manufacturer::getNameById($product.id_manufacturer|escape:'html':'UTF-8')}</span><span class="count">{$product.id_manufacturer|@count}</span></specialbtn>
                {/foreach}    
            </div>
        </div>
    </div>
</div>

Can anyone help me?

Captura de ecrã 2021-07-09, às 12.14.52.png

Link to comment
Share on other sites

48 minutes ago, Crezzur said:

This is a standard function of Prestashop, check my demosite:

https://crezzur.com/demofietsenwinkel/en/3-bicycles

where you can see in the left filtermenu "Brand", is this what you are trying to achieve?

Well is not the same thing because i developed a new module for my client goal, so in that module i show the result of speciefic (new) fields in ps_product with description field, and it show the results and with that page of results i use the brand like filter but in fact isn't, is only a workaround (frontend) to show onclick button.
But i'm trying to achieve (more or less) what you have in your website.

Link to comment
Share on other sites

12 minutes ago, ruisonika said:

Well is not the same thing because i developed a new module for my client goal, so in that module i show the result of speciefic (new) fields in ps_product with description field, and it show the results and with that page of results i use the brand like filter but in fact isn't, is only a workaround (frontend) to show onclick button.
But i'm trying to achieve (more or less) what you have in your website.

This function comes from the Prestashop module ps_facetedsearch maybe you can get some function from this module to work in your new module 😉

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...