[SOLVED] Universal Module shows wrong number of jcomments

More
9 years 1 week ago #53817 by weCombine
dear flexi community,

i m using joomla 3.4.1 and flexicontent 2.2.1rc
with the flexicontent universal module, i want to show the number of comments. the functionality is there, but behaves wrongly:

- it always shows the double of the number of comments
- it ignores if comments are published or not.

i m trying to fix the sql in the helper.php but need some assistance.

cheers
bart

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

More
9 years 1 week ago - 9 years 1 week ago #53830 by ggppdk
i see,
you also say what is not considered:
"if commen is published"

test this fix and in will commit in v3 BETA6 +

in file: helper.php
Code:
$join_comments_type .' #__jcomments AS com ON com.object_id = i.id AND com.object_group="com_flexicontent"' : '' ;
with
Code:
$join_comments_type .' #__jcomments AS com ON com.object_id = i.id AND com.object_group="com_flexicontent" AND com.published="1"' : '' ;


and
Code:
.' WHERE com.object_id IN (' . implode($item_ids, ",") .') AND com.object_group="com_flexicontent" '
with
Code:
.' WHERE com.object_id IN (' . implode($item_ids, ",") .') AND com.object_group="com_flexicontent" AND com.published="1" '


the last one is if we want to list comments inside the module, which is implemented but not 100% finished yet


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 1 week ago by ggppdk.

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

More
9 years 1 week ago #53843 by weCombine
thanks for the fix. it now indeed only shows the published comments.

now, i notice that the wrong amount of counts is related with the number of article categories

so, if the article has 1 category, all is fine.
for 2 categories, it shows the number of comments multiplied by 2
the same for 3 etc...

any idea on this?

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

More
9 years 1 week ago - 9 years 1 week ago #53848 by ggppdk
Hello

test this fix and we will commit the fix for v3 BETA6
replace:
Code:
$select_comments = $add_comments ? ', count(com.object_id) AS comments_total' : '';
with:
Code:
$select_comments = $add_comments ? ', COUNT(DISTINCT com.object_id) AS comments_total' : '';


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 1 week ago by ggppdk.

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

More
9 years 1 week ago #53855 by weCombine
the behaviour with this fix:

if no comments: it shows "0" -> perfect
if 1 or more comments & article in 1 or more categories: it always display "1"

cheers
bart

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

More
9 years 1 week ago - 9 years 1 week ago #53886 by ggppdk
Yes,
com.object_id, is the ID of the item
and
com.id is the ID of the comment


So
Code:
COUNT(DISTINCT com.object_id)
should be:
Code:
COUNT(DISTINCT com.id)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 1 week ago by ggppdk.
The following user(s) said Thank You: weCombine

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.301 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline