Jump to content

How to change that the category also counts the number of product in the subcategory


Recommended Posts

I have parent categories having subcategories but in the parent category there are no products.
When you go to the partent category page it says 0 products. The child categories have multiple products.
How to change the counting of the products so it also count the product of the child categories. This way the parent page will count all the products that fall under this parent.
Thanks in advance,

Geert

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Hi

This does need fixing. 0 Products makes it appear that there are no products at all.

In your Theme folder

Open category.tpl and delete (comment) Line 13

{$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}



Or replace with this

{if $nb_products>0}
{$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}
{/if}



This will only display the number of products if it contains products.


Or even This

{if $nb_products>0}
{$nb_products|intval} {if $nb_products>1}{l s='products'}{else}{l s='product'}{/if}
{else}
- click a subcategory
{/if}




Regards

Ken.

Link to comment
Share on other sites

  • 2 years later...

Thanks Ken, here is the change that will work in v1.4 of prestashop, since the category.tpl is a bit different now. This


Change Line 35-40 from:

               
{if $category->id == 1 OR $nb_products == 0}{l s='There are no products.'}
{else}
   {if $nb_products == 1}{l s='There is'}{else}{l s='There are'}{/if} 
   {$nb_products} 
   {if $nb_products == 1}{l s='product.'}{else}{l s='products.'}{/if}
{/if}



to...

{if $nb_products>0}
   {if $nb_products == 1}{l s='There is'}{else}{l s='There are'}{/if} 
   {$nb_products} 
   {if $nb_products == 1}{l s='product.'}{else}{l s='products.'}{/if}
{else}
- click a subcategory
{/if} 

Link to comment
Share on other sites

  • 4 months later...
  • 3 weeks later...

hey guys did anyone find a code so the parent navigation can count all products in the subcategories

cheers kev

 

 

Bump. I think this is really important as a commercial website. If you can see all the subcategories but the parent category only counts the product you have assigned to the parent category (which could be considered "featured products" of that main category) it causes the users to think you only have a few products of that commercial line, when you might have hundreds in the subcategories. I think i am going to open a bug/feature request with this...

Link to comment
Share on other sites

×
×
  • Create New...