Jump to content

number of products under each subcategory


Recommended Posts

Hello

 

How can i put the number of products next to each subcategory?

 

With this we count the number of products in the category:

 

 

{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}

 

But i also have subcategories and i want the number of items in the subcategories next to the subcategory image.

 

Can anyone help me?

 

Thx

post-302098-0-46291300-1321451538_thumb.jpg

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

Under classes/category.php, I found that we have a function:

* @param integer $id_lang Language ID
     * @param integer $p Page number
     * @param integer $n Number of products per page
     * @param boolean[b] $getTotal return the number of results instead of the results themself[/b]
     * @param boolean $active return only active products
     * @param boolean $random active a random filter for returned products

public function getProducts($id_lang, $p, $n, $orderBy = NULL, $orderWay = NULL, [b]$getTotal = false[/b], $active = true, $random = false, $randomNumberProducts = 1, $checkAccess = true)

 

I wonder if there is a way of using this function to produce number of products under each subcategory? what code would we have to put into an override of CategoryController.php ?

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...