Posts: 13
Threads: 3
Joined: Jun 2022
Hi,
I have to integrate a lot of code into database when I insert a new comment.
How is it possible or where could I find the correct file.
Many thanks
Ben
Posts: 13
Threads: 3
Joined: Jun 2022
Hi,
I used javascript to interact with commentics, but, is there a variable for error messages ?
Or how is it possible to detect when the comment is inserted.
I tried to use cmtx_message class and id for textarea but it is not good.
Is this possible to add "id" parameter for error or success message ?
Thanks.
Posts: 13
Threads: 3
Joined: Jun 2022
Posts: 13
Threads: 3
Joined: Jun 2022
Up
Posts: 2,902
Threads: 59
Joined: Jun 2010
Hi Ben,
Sorry for the late reply. If you need to make database changes whenever a comment is inserted, I think the best thing would be to modify the createComment() method in the /system/library/comment.php class.
Have
you completed
the interview?
Posts: 13
Threads: 3
Joined: Jun 2022
Hi Steven,
Many thanks for your answers, but for me, it is more simple to not change commentics libraries.
Is it possible to add an id attribute to the message in the template ?
You can see that I do here :
https://www.lamaraudiere.com/d4ua/dernie...uage=en-US
"document.getElementById("cmtx_submit_button").addEventListener("click", function(e) {
if (document.getElementById("cmtx_comment").value.length>0) {
arrDatas = {
"type" : "NEWS",
};
addNotifications(arrDatas);
}
});"
Posts: 13
Threads: 3
Joined: Jun 2022
I found this : <div class="cmtx_message cmtx_message_success">{{ success }}</div>
in this file : frontend\view\default\template\main\user.tpl
Is this possible to add id attribute in this line ?
I can not intercept class with getElementsByClassName()
Many thanks
Posts: 2,902
Threads: 59
Joined: Jun 2010
The user.tpl file is for the page where users manage their email preferences and subscriptions.
I think you'll need to edit the file '/frontend/view/default/javascript/common.js'.
If you search for this:
Code:
jQuery('#cmtx_form').before('<div class="cmtx_message cmtx_message_success">' + response['result']['success'] + '</div>');
You should find two instances. You'll want to modify the first instance.
Then in Extensions -> Themes, if your 'Optimize' setting is disabled, you don't need to do anything else. If it's enabled though, you'll need to use Gulp to concatenate and minify the JavaScript files. There's some documentation about that below:
https://commentics.com/build-tools
Have
you completed
the interview?
Posts: 13
Threads: 3
Joined: Jun 2022
Hi Steven,
Many thanks for your helps.
Have you an example with javascript without jquery ?
Posts: 2,902
Threads: 59
Joined: Jun 2010
I'm not sure what you mean. Commentics uses jQuery so that's what you'll need to edit.
Have
you completed
the interview?