How To Count Products Found Inside The Category Page

how can i show the number of products found in the category page

Hello!

Try to use the {hook name="products:product_amount"} hook that is defined in the design/themes/THEME/templates/common/product_data.tpl file.

Thank for the reply, Im actually looking for the total number of product found under the selected category.

Example:

category: cellphones 3 items under category cellphones this is what i want

product1

product2

product3

You can use the following code

{$c_data = $product.main_category|fn_get_category_data}
{$c_data.product_count} {__('items_under_category')} {$c_data.category}

Note: products in subcategories are not taken into account in this case.

You can use the following code

{$c_data = $product.main_category|fn_get_category_data}
{$c_data.product_count} {__('items_under_category')} {$c_data.category}

Note: products in subcategories are not taken into account in this case.

I tried it but it's not working

I did this and it worked

{$c_data = $category_data.category_id|fn_get_category_data}
{$c_data.product_count}
How can i count the subcategories?

Hello

If this is not the last level category, this field contains 0. You must enter the last level category that contains the products.

Best regards

Robert

I did this and it worked

{$c_data = $category_data.category_id|fn_get_category_data}
{$c_data.product_count}
How can i count the subcategories?

In this case more complex changes are required. There is no special function to retrieve such data