Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2016-03-08 00:43:13

zet
Member
From: Lehrte, Germany
Registered: 2016-03-05
Posts: 18
Website

Need help with identifier in faq section

Could someone please provide a meaningful example on how to use
"Identifier, can be used to filter questions by identifier"?

I have no idea what to enter here.

Offline

#2 2016-03-08 11:09:26

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Need help with identifier in faq section

Hi zet,
thank you for your message in the Live Helper Chat Forum!

I AM sorry, I cannot help you with your specific request.

I can provide only basic support here.
For advanced support you can try to wait here a reply or use commercial support (link on my post signature).
You can also try to look into the documentation: https://livehelperchat.com/documentation-6c.html

Have a great day and time!


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#3 2016-03-09 10:08:57

zet
Member
From: Lehrte, Germany
Registered: 2016-03-05
Posts: 18
Website

Re: Need help with identifier in faq section

Well,
now that nobody seems to know an answer and I couldn't find any hints on how to make use of the "Identifier", I decided to re-use it for grouping FAQs by priority.

Actually, I wasn't really satisfied that the latest FAQ is shown on top, because the latest FAQ isn't necessarely the most important FAQ - and I want the most important FAQs on top of my list.

And it needs only 2 small code changes to make it work this way: Referring to 2.40 this is

Line #15 of modules/lhfaq/list.php

$items = erLhcoreClassModelFaq::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page,'sort' => 'identifier DESC'));

and Line #152 of modules/lhfaq/faqwidget.php

$q->orderBy('has_url DESC, identifier DESC' ); // Questions with matched URL has higher priority

Right now, the database records are no longer sorted by id, but by the identifier column (in descending order as before)

All what's left to do is finding a simple ordering scheme for the backend. And I decided to go with just 3 digits:
"999" will make my most important FAQ appear on top, as "000" will display the least important FAQ at the bottom now.
(note, that even when using numbers the database keeps on sorting literally)

Have fun!

Last edited by zet (2016-03-09 10:14:03)

Offline

#4 2016-03-09 10:10:53

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Need help with identifier in faq section

Hi zet,
thank you for your feedback.

I AM happy to hear you have found a solution.
Have a very great time!

Thank you for use Live Helper Chat and Live Helper Chat Forum!


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#5 2016-03-09 18:33:12

zet
Member
From: Lehrte, Germany
Registered: 2016-03-05
Posts: 18
Website

Re: Need help with identifier in faq section

Shame on me!

There IS a manual page at https://livehelperchat.com/faq-module-112a.html.

And the first question of course is: Do my changes interfere with the original functionality? No and yes.
No, as long as you're not making use of the identifier on the widget side.
Yes, if you do so. Since the original idea was like:

Peparing ... let's say ...  5 FAQs for your English visitors with an identifier 'en' on the backend
and 3 FAQs for your German visitors with a different identifier 'de'

Running your FAQ widget WITHOUT identifier would show a mixup of all 8 FAQs to everyone then.
But when using the same identifier in your widget as defined in the backend, you're able to select just those FAQs you want to display:
with 'en' the 5 English FAQs and with 'de' the 3 German FAQs.

Now, that is has become clear that the intentional idea was based on exactly matching identifiers, my own approach - giving each FAQ a different identifier - CANNOT work. Too bad, yes.

But hold on - there's a solution in sight...

Last edited by zet (2016-03-09 18:34:54)

Offline

#6 2016-03-09 18:37:52

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Need help with identifier in faq section

Hi zat,
I can just link the documentation https://livehelperchat.com/documentation-6c.html of the Live Helper Chat.
Remember this is an OpenSource project,
volunteers here can help you with the basic settings.

I AM sorry but cannot help you with FAQ.
Thank you!
Have a great time!


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#7 2016-03-09 20:22:28

zet
Member
From: Lehrte, Germany
Registered: 2016-03-05
Posts: 18
Website

Re: Need help with identifier in faq section

Don't worry about me, I'm fine Marco!

I think you got me wrong. I've no more problems, I'm just trying to bring both worlds (original idea and my approach) together.  smile
So here we go ...

As already mentioned, the original code is doing a strict comparison of the identifier saved in the backend and the identifier which is used with the widget. Thus, if we want to achieve separating FAQs on one hand AND sorting on the other, we need
1.) a less strict comparison and
2.) a smart identifier like "en_999" with a first part to make separating work and a trailing part for sorting.

Luckily enough the database allows to make use of "LIKE" instead of "EQUAL" which will help us to loosen strength on the compare. The necessary code changes (again referring to V2.4) have to be made on Line #118 and Line #148 of modules/lhfaq/faqwidget.php. Simply replace them by

$whereConditions[] = $q->expr->like( 'identifier', $q->bindValue($identifier) );

Save, clean cache and your already done.

Next is setting up some English FAQs in the backend like

------ FAQ --------- identifier
- Most important FAQ - en_999
- Less important FAQ - en_901
- Least important FAQ - en_000

and the same way for German visitors, this time using 'de_XXX' as identifier

------ FAQ --------- identifier
- Most important FAQ - de_999
- Less important FAQ - de_901
- Least important FAQ - de_000

Again, we have completely different identifiers, just the leading 3 characters are the same. But since we're using LIKE now with the database, we can use the SQL wildcard '%' (percent) on the widget side.
So, if we want to display the English FAQs only, we simply have to add 'en_%' as the widget identifier. Only the first 3 characters have to match the backend identifier with the new code, but the trailing part will be used for sorting as before.

That's it. smile

Last edited by zet (2016-03-09 20:28:07)

Offline

Board footer