Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Count Products Found Inside The Category Page Rate Topic   - - - - -

 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 57 posts

Posted 18 May 2019 - 11:25 PM #1

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



 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 280 posts

Posted 19 May 2019 - 07:04 AM #2

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.



 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 57 posts

Posted 19 May 2019 - 08:24 PM #3

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



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19269 posts

Posted 20 May 2019 - 06:08 AM #4

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.


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 57 posts

Posted 25 May 2019 - 02:03 AM #5

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



 
  • Dexterflamez
  • Advanced Member
  • Trial users
  • Join Date: 08-Jan 18
  • 57 posts

Posted 25 May 2019 - 02:19 AM #6

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?


 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 690 posts

Posted 25 May 2019 - 11:26 AM #7

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


Team of SoftSolid
cs-cart.pl

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19269 posts

Posted 27 May 2019 - 08:19 AM #8

 

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


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.