Error in KnowledgeBase Categories view

  • Paul Adamson
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #151813 by Paul Adamson
Error in KnowledgeBase Categories view was created by Paul Adamson
Hi Tuan, I just upgraded one of my sites to 5.1.4.  When I go to a page showing a Categories view of kb articles, none of the article links have urls with the article alias appended.  They just point to the category instead.  What I found was that the HDP router wants the alias to be able to create the url, but the Categories model only retrieves the article id and title.  I modified this code in /components/com_helpdeskpro/Model/Categories.php to add the alias and it resolves the problem.
Code:
protected function beforeReturnData($rows) { $db = $this->getDbo(); $query = $db->getQuery(true); $fieldSuffix = HelpdeskproHelper::getFieldSuffix(); $query->select('id, title, alias') [b]// Added alias here[/b] ->from('#__helpdeskpro_articles') ->order('ordering'); if ($fieldSuffix) { DatabaseUtils::getMultilingualFields($query, ['title'], $fieldSuffix); } foreach ($rows as $row) { $query->where('category_id = ' . $row->id) ->where('published = 1'); $db->setQuery($query, 0, 10); $row->articles = $db->loadObjectList(); $query->clear('where'); } }

Cheers
Paul

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

  • Paul Adamson
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #151814 by Paul Adamson
Replied by Paul Adamson on topic Error in KnowledgeBase Categories view
Sorry the version of HDP is 5.1.1

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

More
2 years 7 months ago #151821 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Error in KnowledgeBase Categories view
Thanks Paul. Yes, there was a bug as you mentioned. However, the solution is a bit different since we have to support multilingual, too.

I just updated the download package on server with the correct fix. Please access to My Downloads menu item, download latest package, upgrade it to your site and check it again. The issue should be sorted

Thanks again.

Tuan

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

  • Paul Adamson
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
2 years 7 months ago #151841 by Paul Adamson
Replied by Paul Adamson on topic Error in KnowledgeBase Categories view
Re-installed with new version and all works well now.

Cheers!

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

More
2 years 7 months ago #151842 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Error in KnowledgeBase Categories view
Great. Thanks for confirming Paul

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

Moderators: Tuan Pham Ngoc