Keyword

Item counter in categories problem

  • bgiguere
  • bgiguere's Avatar Topic Author
  • Offline
  • New Member
More
14 years 2 months ago #85457 by bgiguere
Item counter in categories problem was created by bgiguere
Hello all.  I seem to have run into a problem with my item counter (next to the title) in the categories view.  I invite you to follow this link : www.brigittegiguerecourtiere.com/index.php?option=com_k2&view=itemlist&layout=category&task=category&id=121
You will notice a number of sub-categories.  The sub-categories : Bureautique/technologie, Communication, Dév. matériel de cours and Équipes, gestionnaires, exécutifs, are showing the proper item counter numbers.  The other sub-categories, are not.  They are showing way out of proportion numbers.  As an example: Formation des formateurs is showing (48) items, but in reality there are only 6 (if you click on the sub-category, you'll see them).  This is the only category this is happening to.  I don't understand what's happening because if I check the category and sub-categories in the back-end (administrator), the proper item count is showing.   Also, I tried disabling the 'item count' option and it still shows the numbers.  Help!!   Thanks in advance for your help.

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

More
14 years 2 months ago #85458 by william white
Replied by william white on topic Item counter in categories problem
Have you deleted any items?

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

  • bgiguere
  • bgiguere's Avatar Topic Author
  • Offline
  • New Member
More
14 years 2 months ago #85459 by bgiguere
Replied by bgiguere on topic Item counter in categories problem
Thanks for your response. Yes I do have a number of deleted items, some in the categories published and some in trashed categories.

William White said:Have you deleted any items?

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

More
14 years 2 months ago #85460 by william white
Replied by william white on topic Item counter in categories problem
I havent seen this before, but you might try permenantly deleting the items already in the trash for the category that is displaying incorrectly and see if that makes a difference.

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

  • bgiguere
  • bgiguere's Avatar Topic Author
  • Offline
  • New Member
More
14 years 2 months ago #85461 by bgiguere
Replied by bgiguere on topic Item counter in categories problem
Well, I have permanently deleted the 'trashed' items and categories and it hasn't changed anything. Any other suggestions? Thanks again.

William White said:I havent seen this before, but you might try permenantly deleting the items already in the trash for the category that is displaying incorrectly and see if that makes a difference.

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

More
14 years 2 months ago #85462 by Martin Silva
Replied by Martin Silva on topic Item counter in categories problem
in components\com_k2\models\itemlist.php
search this:
$categories = K2ModelItemlist::getCategoryChilds($id);
and remplace for:
$categories = K2ModelItemlist::getCategoryChilds($id,true);
in the function "countCategoryItems"

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

  • bgiguere
  • bgiguere's Avatar Topic Author
  • Offline
  • New Member
More
14 years 2 months ago #85463 by bgiguere
Replied by bgiguere on topic Item counter in categories problem
Hello Martin,

Thanks for the response. The problem is solved. Much appreciated. Brigitte

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

More
14 years 2 months ago #85464 by william white
Replied by william white on topic Item counter in categories problem
Martin, is this a bug that needs to be fixed or has this been fixed in 2.3 or a svn? (since its a change to the core file that will be lost on upgrade or reinstall)

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

More
14 years 1 week ago #85465 by Jiliko.net
Replied by Jiliko.net on topic Item counter in categories problem
Hi,

For me, it's a bug in the K2ModelItemlist::getCategoryChilds function declaration & code.

File : 'components/com_k2/models/itemlist.php', line 444 (v2.3)

The 2nd parameter is set to 'false' by default but should be 'true' by default to reset the childs array on each external function call.
In the function code, the function is called recursively, and it should be called with a 2nd parameter set to 'false'.

I've already made these changes and waiting for a correction. In 2.4 ?

Olivier

William White said:Martin, is this a bug that needs to be fixed or has this been fixed in 2.3 or a svn? (since its a change to the core file that will be lost on upgrade or reinstall)
Attachments:

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


Powered by Kunena Forum