Jump to content

Knowledgebase search result in both languages


Recommended Posts

13 hours ago, plusplushosting said:

Hi there, is there any way to limit the search result to the selected language?

Chris is right - out of the box, you can't do it from settings... if you had to, you could use a ClientAreaPageKnowledgebase hook to take the array; lookup the language assigned to the article; see if it matches current language and if not remove it from the array... though it's slightly awkward that default language articles don't store the language assigned to it, only the translated articles store the language... but that could be got around.

12 hours ago, WHMCS ChrisD said:

are you using the default "Six" theme?  

he isn't, but I don't think that matters in this case.

one weird thing that I did spot with the OPs site is that if you do a search for 'Cloudlinux' in English and then Spanish, both show duplicates - but the even (2nd, 4th, 6th, 8th) Spanish links don't work correctly... they just redirect back to the knowledgebase categories page - not sure if that's a general bug or an issue with Friendly URLs (e.g non-Latin problem)... doesn't look to be a template issue as it happens with Six on my v7.6.1 dev too. 😕

HUfP1LX.pngxhJbdve.png

after messing with a hook for a few minutes, I think it's a bug and all the links are using the id value in the url - whereas for translations, it looks like it should be using parentid value instead (unless there is a core issue with routepath).

Link to comment
Share on other sites

8 hours ago, brian! said:

Chris is right - out of the box, you can't do it from settings... if you had to, you could use a ClientAreaPageKnowledgebase hook to take the array; lookup the language assigned to the article; see if it matches current language and if not remove it from the array... though it's slightly awkward that default language articles don't store the language assigned to it, only the translated articles store the language... but that could be got around.

he isn't, but I don't think that matters in this case.

one weird thing that I did spot with the OPs site is that if you do a search for 'Cloudlinux' in English and then Spanish, both show duplicates - but the even (2nd, 4th, 6th, 8th) Spanish links don't work correctly... they just redirect back to the knowledgebase categories page - not sure if that's a general bug or an issue with Friendly URLs (e.g non-Latin problem)... doesn't look to be a template issue as it happens with Six on my v7.6.1 dev too. 😕

HUfP1LX.pngxhJbdve.png

after messing with a hook for a few minutes, I think it's a bug and all the links are using the id value in the url - whereas for translations, it looks like it should be using parentid value instead (unless there is a core issue with routepath).

The route path ID issue started on version 7.1+ after they introduced the horrible SEO new structure. I complained about this before several times here in the forums and there is nothing you can do because all the code is completely encoded that generates the URL structures, as before it was inside the TPL templates. The whole FAQ articles and news are worthless in multi local scenarios now, it was bad before, now its not even usable. WHMCS in general is just poorly designed for this, example, tags are also just in English so not really useful to show an article in a foreign language with English tags.

Link to comment
Share on other sites

I don't think there is an issue with routepath in this topic - I suspect routepath is just being passed the wrong information by the array... what I don't really know is whether routepath should be taking this wrong info and fixing to it internally - but that's entering the realms of Wizard of Oz and trying to figure out what's going on behind the curtain. 🧙‍♂️

10 hours ago, yggdrasil said:

The whole FAQ articles and news are worthless in multi local scenarios now, it was bad before, now its not even usable.

though I know your situation is worse because you had custom redirection which is now harder for you to reproduce in the newer versions.

10 hours ago, yggdrasil said:

WHMCS in general is just poorly designed for this, example, tags are also just in English so not really useful to show an article in a foreign language with English tags.

you can add tags in foreign languages and they will work - though it doesn't like tags with 'invalid' characters, e.g in the example tag cloud below, 'alojamiento' will work, but 'virtualización' does not (because the string gets changed in the links)...

49MA9tE.png

... yet it's stored correctly in the database, so it's how WHMCS is using it that's the problem.... though this tag cloud language bug was mentioned during the v6 (yes Six not v7) beta period 3+ years ago... and so it's another one of these long unresolved bugs.

WHMCS is always released before sufficient testing has occurred - sadly, in my time over the last 5+ years, it always has been and that's not going to change any time soon... additionally, multilingual features are VERY under-tested - whether that's as a result of the development teams being US/UK based and not devoting enough time to testing the features, I can't say. 🙊

but to get back to the OPs question, this language issue is fixable with a hook - just got to get my head around the logic of when to delete, and when to change the URLs of, articles in the results... didn't have much time to finish it yesterday as was working on paid projects... plus every time I tested something in the knowledgebase, I kept seeing multiple different bugs (or at best poorly designed/tested features) and I don't want to be lumbered fixing the whole of knowledgebase when there are, I assume, highly-paid developers and testers at WHMCS responsible for doing it! headshake.gif

i'll try and finish the hook off on Tuesday if I get the chance to.

1 minute ago, plusplushosting said:

Yup, was working before V7...and also we were able to workaround the SEO using .htaccess and also modifying the url in the template files for KB and news....now is completely useless....any plan to really fix this?

the problem with Friendly URLs is that WHMCS seemingly don't think that it's broken. 

Link to comment
Share on other sites

3 hours ago, brian! said:

I don't think there is an issue with routepath in this topic - I suspect routepath is just being passed the wrong information by the array... what I don't really know is whether routepath should be taking this wrong info and fixing to it internally - but that's entering the realms of Wizard of Oz and trying to figure out what's going on behind the curtain. 🧙‍♂️

though I know your situation is worse because you had custom redirection which is now harder for you to reproduce in the newer versions.

you can add tags in foreign languages and they will work - though it doesn't like tags with 'invalid' characters, e.g in the example tag cloud below, 'alojamiento' will work, but 'virtualización' does not (because the string gets changed in the links)...

49MA9tE.png

... yet it's stored correctly in the database, so it's how WHMCS is using it that's the problem.... though this tag cloud language bug was mentioned during the v6 (yes Six not v7) beta period 3+ years ago... and so it's another one of these long unresolved bugs.

WHMCS is always released before sufficient testing has occurred - sadly, in my time over the last 5+ years, it always has been and that's not going to change any time soon... additionally, multilingual features are VERY under-tested - whether that's as a result of the development teams being US/UK based and not devoting enough time to testing the features, I can't say. 🙊

but to get back to the OPs question, this language issue is fixable with a hook - just got to get my head around the logic of when to delete, and when to change the URLs of, articles in the results... didn't have much time to finish it yesterday as was working on paid projects... plus every time I tested something in the knowledgebase, I kept seeing multiple different bugs (or at best poorly designed/tested features) and I don't want to be lumbered fixing the whole of knowledgebase when there are, I assume, highly-paid developers and testers at WHMCS responsible for doing it! headshake.gif

i'll try and finish the hook off on Tuesday if I get the chance to.

the problem with Friendly URLs is that WHMCS seemingly don't think that it's broken. 

But what I mean is that you cannot define which tag corresponds to a specific locale article. For each article you have a separated text box, each on its own language, but for tags its globally on the top and applies to all articles at the same time. So if you create tags in English, French and Italian, those tags are displayed on all articles regardless of the language from the article. This is what I mean they don't work with different languages. Makes no sense to display french tags in an Italian article or English ones in a French article. Tags cannot be set per each article on its own locale. I hope that makes sense.

Edited by yggdrasil
Link to comment
Share on other sites

On 29/10/2018 at 18:06, yggdrasil said:

I hope that makes sense.

perfect sense - spotted that at the weekend when testing... it's a legacy of the developers being English-centric... though personally I wouldn't be bothered seeing a Spanish tag on an English article... ideally, it would be better if it wasn't there, but it wouldn't keep me awake at night. 😴

all WHMCS would need to do is...

  1. add a 'language' column to the tblknowledgebasetags database table.
  2. add tag options to the supportkb.php page in the admin area for the translated articles.
  3. adjust output in client area to show tags only for current language (or default tags if current language = default).

another weird contradiction is that tag links with 'invalid' characters work fine in the admin area...

3XNuMnO.png

... it's only the client area where they wouldn't work - which is a ridiculous state of development and testing. headshake.gif

On 29/10/2018 at 14:28, plusplushosting said:

Thax Brian to take the time to reply and come with solutions...even when is not who should provide it 🙂

when you get the chance, can you try the attached hook file - upload it to /includes/hooks and let me know if it works for you... i've tested it locally, but you've got far more translated articles than I have in my dev, so it will be a better test. 🙂

if you change your language to Spanish in the client area, and do a search, then it should find *only* Spanish articles... and their links should work correctly; change it back to English, and the search should only find English articles...

xpxrHJF.png

also, on the knowledgebase homepage, the hook can limit the "Most Popular" articles to the current language too...

mVJuLJR.png

the shown articles counts will likely be wrong for each category (both on homepage and sidebar - though could be fixed with hooks), and you could tweak the tag cloud sidebar to remove the non-functioning non-latin words... but as I say, I can see multiple issues in knowledgebase and it's a Pandora's box that i'm trying not to open! 🙂

 

Link to comment
Share on other sites

9 minutes ago, plusplushosting said:

have a bug...searching is working great...but now the articles listing when you select the category is not listing the articles in Spanish.

Select Spanish from the top/right menu then try to click to any of the categories and is not listing the articles. In English is working ok.

you can see why I labelled it v1.0 now ! 🙂

can you do two things for me...

  1. edit the hook and change...
    return array("kbarticles" => $kbarticles);

    to...

    return array("kbarticles2" => $kbarticles);

     

  2. add {debug} to the end of the knowledgebasecat.tpl template.

if you then go to the categories page, choose the NodeJS category (as it only has 3 articles) - you should see a popup window... if you can PM me a screenshot of the $kbarticles and $kbarticles2 arrays from that window, it might give me a clue as to what's going on... after you've don't that, remove {debug} from the template.

Link to comment
Share on other sites

Thanx Brian! After changing that ...now searching in english is returning the spanish articles too.

Here are the values....

Quote

$kbarticles

Origin: "Smarty object"

Value

Array (9)
0 => Array (6)
  id => 526
  title => "Can I refer myself?"
  urlfriendlytitle => "Can-I-refer-myself"
  article => "Unfortunately you can’t. The affiliate program is to refer new clients."
  views => 9593
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=526"
1 => Array (6)
  id => 516
  title => "How much do you pay?"
  urlfriendlytitle => "How-much-do-you-pay"
  article => "We pay the 15% of the amount paid by each referred client in RECURRING manner..."
  views => 8645
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=516"
2 => Array (6)
  id => 513
  title => "How should i start?"
  urlfriendlytitle => "How-should-i-start"
  article => "Just login in your Client Area, click in the Affiliates link, read the rules ..."
  views => 7399
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=513"
3 => Array (6)
  id => 522
  title => "I have reached the payout amount, how should i request to withdraw my commiss..."
  urlfriendlytitle => "I-have-reached-the-payout-amount-how-should-i-request-to-withdraw-my-commission"
  article => "Once the balance reaches the affiliate payout amount a "Request Withdrawal" b..."
  views => 8341
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=522"
4 => Array (6)
  id => 518
  title => "Im not a client or i do not have any active service with you, can i be an aff..."
  urlfriendlytitle => "Im-not-a-client-or-i-do-not-have-any-active-service-with-you-can-i-be-an-affi..."
  article => "Depends. If you qualify for the Premium Affiliate Program, which means you ha..."
  views => 8229
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=518"
5 => Array (6)
  id => 528
  title => "Is there a limit to how many people I can refer?"
  urlfriendlytitle => "Is-there-a-limit-to-how-many-people-I-can-refer"
  article => "No. More you refer more you earn."
  views => 8702
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=528"
6 => Array (6)
  id => 524
  title => "What happen with the money i have earned if i cancel my client account?"
  urlfriendlytitle => "What-happen-with-the-money-i-have-earned-if-i-cancel-my-client-account"
  article => "Canceling your services and client account with us you are cancelling any agr..."
  views => 7945
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=524"
7 => Array (6)
  id => 511
  title => "What is the advantage of your affiliate program?"
  urlfriendlytitle => "What-is-the-advantage-of-your-affiliate-program"
  article => "We are a small company and we focus to customer care, so we pay a reasonable ..."
  views => 8106
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=511"
8 => Array (6)
  id => 520
  title => "When do you pay?"
  urlfriendlytitle => "When-do-you-pay"
  article => "We pay after 45 days of your referred client signup. Note if the client use o..."
  views => 9105
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=520"
 

$kbarticles2

Origin: "Smarty object"

Value

Array (9)
0 => Array (6)
  id => 526
  title => "Can I refer myself?"
  urlfriendlytitle => "Can-I-refer-myself"
  article => "Unfortunately you can’t. The affiliate program is to refer new clients."
  views => 9593
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=526"
1 => Array (6)
  id => 516
  title => "How much do you pay?"
  urlfriendlytitle => "How-much-do-you-pay"
  article => "We pay the 15% of the amount paid by each referred client in RECURRING manner..."
  views => 8645
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=516"
2 => Array (6)
  id => 513
  title => "How should i start?"
  urlfriendlytitle => "How-should-i-start"
  article => "Just login in your Client Area, click in the Affiliates link, read the rules ..."
  views => 7399
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=513"
3 => Array (6)
  id => 522
  title => "I have reached the payout amount, how should i request to withdraw my commiss..."
  urlfriendlytitle => "I-have-reached-the-payout-amount-how-should-i-request-to-withdraw-my-commission"
  article => "Once the balance reaches the affiliate payout amount a "Request Withdrawal" b..."
  views => 8341
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=522"
4 => Array (6)
  id => 518
  title => "Im not a client or i do not have any active service with you, can i be an aff..."
  urlfriendlytitle => "Im-not-a-client-or-i-do-not-have-any-active-service-with-you-can-i-be-an-affi..."
  article => "Depends. If you qualify for the Premium Affiliate Program, which means you ha..."
  views => 8229
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=518"
5 => Array (6)
  id => 528
  title => "Is there a limit to how many people I can refer?"
  urlfriendlytitle => "Is-there-a-limit-to-how-many-people-I-can-refer"
  article => "No. More you refer more you earn."
  views => 8702
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=528"
6 => Array (6)
  id => 524
  title => "What happen with the money i have earned if i cancel my client account?"
  urlfriendlytitle => "What-happen-with-the-money-i-have-earned-if-i-cancel-my-client-account"
  article => "Canceling your services and client account with us you are cancelling any agr..."
  views => 7945
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=524"
7 => Array (6)
  id => 511
  title => "What is the advantage of your affiliate program?"
  urlfriendlytitle => "What-is-the-advantage-of-your-affiliate-program"
  article => "We are a small company and we focus to customer care, so we pay a reasonable ..."
  views => 8106
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=511"
8 => Array (6)
  id => 520
  title => "When do you pay?"
  urlfriendlytitle => "When-do-you-pay"
  article => "We pay after 45 days of your referred client signup. Note if the client use o..."
  views => 9105
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=520"

 

Link to comment
Share on other sites

ok...im an idiot....here is the output....

Quote

$kbarticles

Origin: "Smarty object"

Value

Array (3)
0 => Array (6)
  id => 1736
  title => "What is NodeJS?"
  urlfriendlytitle => "What-is-NodeJS"
  article => "Node.js is a library and environment for execution of I / O guided by asynchr..."
  views => 49
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1736"
1 => Array (6)
  id => 1738
  title => "Do you support NodeJS?"
  urlfriendlytitle => "Do-you-support-NodeJS"
  article => "At this time we are supporting NodeJS in the Enterprise hosting plans."
  views => 36
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1738"
2 => Array (6)
  id => 1740
  title => "Managing your NodeJS apps in cPanel"
  urlfriendlytitle => "Managing-your-NodeJS-apps-in-cPanel"
  article => "End User interface in cPanel allows end users to setup and manage Node.js for..."
  views => 30
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1740"
 

$kbarticles2

Origin: "Smarty object"

Value

Array (3)
0 => Array (6)
  id => 1736
  title => "What is NodeJS?"
  urlfriendlytitle => "What-is-NodeJS"
  article => "Node.js is a library and environment for execution of I / O guided by asynchr..."
  views => 49
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1736"
1 => Array (6)
  id => 1738
  title => "Do you support NodeJS?"
  urlfriendlytitle => "Do-you-support-NodeJS"
  article => "At this time we are supporting NodeJS in the Enterprise hosting plans."
  views => 36
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1738"
2 => Array (6)
  id => 1740
  title => "Managing your NodeJS apps in cPanel"
  urlfriendlytitle => "Managing-your-NodeJS-apps-in-cPanel"
  article => "End User interface in cPanel allows end users to setup and manage Node.js for..."
  views => 30
  editLink => "https://secure.plusplushosting.net/admin/supportkb.php?action=edit&id=1740"

 

Link to comment
Share on other sites

17 hours ago, plusplushosting said:

Thanx Brian! After changing that ...now searching in english is returning the spanish articles too.

that's expected - it's returning an array that isn't used by the template... I just needed to see what the array actually was.

I copied your NodeJS category locally for testing and have made a couple of changes to the hook (it now searches database by article title rather than ID, and removes duplicate array elements from search results) - the dupe removal feature needs testing on your site as it has more articles than mine.

i've attached v1.1 for you to try. thanks.png

btw - what an absolute pain it is to enter multilingual kb articles via the admin area - if I'd had to enter any more than 3, I would have just edited the database table directly!

 

Link to comment
Share on other sites

Thanx!

Quote

btw - what an absolute pain it is to enter multilingual kb articles via the admin area - if I'd had to enter any more than 3, I would have just edited the database table directly!

After the article number 20 your fingers have they own life 🙂

I guess we will go with v1.2 🙂 ....searching a work is returning only one article...for example you search "cpanel" and is showing only one article. The rest looks like is working as expected.

Thanx again!

Link to comment
Share on other sites

20 hours ago, plusplushosting said:

I guess we will go with v1.2 🙂 ....searching a work is returning only one article...for example you search "cpanel" and is showing only one article. The rest looks like is working as expected. 

v1.2 attached.. i've just removed the if condition that I recently added... i'm sure that I put that in there for a good reason, but i'll be primed for v1.3 if it doesn't work as intended lol.

Link to comment
Share on other sites

Thanx! simply perfect! working as expected.....hey whmcs guys....took him few minutes have this working.....perhaps is time to include a new fresh developer in the crew :-)...or at least send him a portion of the millions billed, hahaha

Thanx again Brian! Ill add you in my list as probably will need some coded stuff.

Link to comment
Share on other sites

28 minutes ago, plusplushosting said:

Thanx! simply perfect! working as expected....

not quite... if you change your language to Spanish, do a search for 'nodejs', the results show duplicates (screenshot from my dev, but same happens on your site too)...

EOYLnEu.png

hopefully v1.3 will fix this for you too - i've put that if statement back in (I knew there was a reason it was in there!), but tweaked it a little. thanks.png

7FmZHuz.png

53 minutes ago, plusplushosting said:

hey whmcs guys....took him few minutes have this working.....perhaps is time to include a new fresh developer in the crew :-)...or at least send him a portion of the millions billed, hahaha

given the choice of either working for WHMCS or receiving a percentage of WHMCS revenue, i'll choose the percentage every time. 😁

kblangart.php

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated