Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Knowledge base "Help Topics" multiplication - not critical

When I press on clients Knowledge base "Category" item (/helpdesk/kb/faq.php?cid=1) the "Help Topics" in the right section get multiplied. 
image

If the topics are in the same category, the block gets populated with same categories for each topic.

image

faq-category.inc.php code fragment:

<?php
foreach (Topic::objects()
    ->filter(array('faqs__faq__category__category_id'=>$category->getId()))
    as $t) { ?>
        <a href="?topicId=<?php echo urlencode($t->getId()); ?>"
            ><?php echo $t->getFullName(); ?></a>
<?php } ?> 

The code returns an array of all values for all topics instead of distinct values.

The temporary solution is to replace the code with the one from kb-search.inc.php, so it lists just all topics from knowledgebase instead of only related to a selected category.

<?php
foreach (Topic::objects()
    ->annotate(array('faqs_count'=>SqlAggregate::count('faqs')))
    ->filter(array('faqs_count__gt'=>0))
    as $t) { ?>
        <div><a href="?topicId=<?php echo urlencode($t->getId()); ?>"
            ><?php echo $t->getFullName(); ?></a></div>
<?php } ?>

Comments

Sign In or Register to comment.