Category Product Count Incorrect

  • Posts: 36
  • Thank you received: 4
  • Hikashop Business
2 months 3 weeks ago #358920

-- url of the page with the problem -- : www.bikergearsuperstore.co.uk/bikes
-- HikaShop version -- : 5.0.2
-- Joomla version -- : 5.0.2

Hi,

Please see screenshot.

The category counts are incorrect. They show 36 and 8 products, but there are actually 8 and 4 products.

Thanks,

Regards,
Colin.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 3 weeks ago #358921

Hi,

Counting accurately the products of a category can be quite complex as it needs to handle sub categories, sub sub categories, products in several sub categories, plugins, and potentially many of the settings in the menu item options.
For example, if you activate the "show discounted products only" setting of your menu item, the products without discount won't appear on the products listings of the categories of your menu item. However, when the menu item is displaying the categories listing, it doesn't take into account this setting and count the products whether they have discounts or not. If we wanted to take this setting into account, for a categories listing with 10 categories, we would need to run at least 30 complex MySQL queries (3 for each category) in order to know whether we can count or not the products since knowing if a discount can be applied to a product or not is actually quite complex in itself.
So, to make it easier for us, and also to lighten the processing of categories listings (which would be quite problematic if the count of products is activated and you have tens of thousands of products, and would probably just crash in the middle) we decided to not support that "show discounted products only" setting.
Another example would be if you have the www.hikashop.com/marketplace/product/222...-product-plugin.html plugin on your website. This plugin will filter out the products from the products listing if their sale end date is in the past or their sale start date is in the future. However, on the categories listing, the plugin doesn't do anything and thus the code counting the products is not affected by it.

So basically, what this all means is that you probably have a setting in your menu item which restricts the number of products being displayed on the listing, or that you have some kind of plugin filtering the products, or something like this, which would be complex to support for the counting of the products on the categories.
A simple solution in that case would be to turn off the filtering you're using on the products listing so that the products listed match with the counting.
Not knowing how you setup your menu item, nor what plugins you're using, I can't say for sure what is filtering the products though.

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 4
  • Hikashop Business
2 months 3 weeks ago #358950

Hi Nicolas,

Thanks for your reply.

The categories in question have no sub categories and I have not activated "show discounted products only" for the categories or menu items.

I don't have tens of thousands of products in the categories. There is a total of 12 products across the 2 categories.

I don't have the Hide unavailable product plugin installed.

I don't think the issue is caused by anything restricting the number of products being displayed, because all products are being displayed.

Bearing tis in mind, does this narrow down what is causing the issue?

Regards,
Colin.

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 3 weeks ago #358954

Hi,

I would first need to get some screenshots of the settings of the menu item.
Also, if all the products are displayed, then there must be something else which causes the system to count like that.
Could you also provide the screenshots of the settings of a product from there ?

Please Log in or Create an account to join the conversation.

  • Posts: 36
  • Thank you received: 4
  • Hikashop Business
2 months 3 weeks ago #358983

Hi Nicolas,

I have attached some screenshots.

Regards,
Colin.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81590
  • Thank you received: 13079
  • MODERATOR
2 months 3 weeks ago #358985

Hi,

I see we're onto something here.
I understand that you provided a screenshot of the settings of the menu item with the id 1001 which is used for the "new bikes" menu item.
However, on the categories listing, the system uses the settings of the menu item with the id 1002. The 1001 menu item must be a child of the 1002 menu item on your website.
So the issue is probably caused by a difference in settings between the "products options" tab of both menu items. At least, I would recommend following this clue and comparing the settings of both.

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum