Jump to content

Post New Support Ticket Knowledgebase check

Recommended Posts

I am trying to tweak /plugins/support_manager/views/default/client_tickets_add.pdt so that is shows similar knowledgebase questions to what the user types in the Ticket Summary box. So far i have added a DIV to put the similar KB's in and set a key press event:

<div class="form-group">
                $this->Form->label($this->_('ClientTickets.add.field_summary', true), 'summary');
                $this->Form->fieldText('summary', $this->Html->ifSet($vars->summary), ['id' => 'summary', 'class' => 'form-control', 'onkeyup' => 'loadKBArticles(event)', 'placeholder' => $this->_('ClientTickets.add.placeholder_summary', true)]);
                <div id="matchingKB" style="display: none;">

I have added a script to the bottom of the page but I cant seem to get anywhere with accessing the model to search the KBs:

function loadKBArticles( value ) {

    $element = document.getElementById("matchingKB");
    $element.innerText =<Similar KB Links Here>;

I have tried lots of different ways of accessing the API to get the data. I know I need to access the model SupportManagerKbArticles and use the search function but i cant work it out. Anyone able to help a novice out?! I am keen to learn

Share this post

Link to post
Share on other sites

It sounds like you're trying to create your own "auto-complete". Auto-complete functionality is already supported. You can call the jQuery function "autocomplete()". Take a look at the admin_tickets.pdt template file for reference.

You'll probably need to create a new controller method to retrieve the information you're going to fetch in an AJAX request.

Share this post

Link to post
Share on other sites

I am not trying to auto complete the text, I am trying to lookup content, we currently use Hesk for our ticketing system and I want to switch this over to blesta. http://help.4matrix.com/index.php?a=add that is our current ticket page, if you type 'install' in the subject and message box, it will auto suggest some Knowledgebase articles related to what you have typed. ClientExec also have an this feature, http://demo.clientexec.com/index.php?fuse=support&controller=ticket&view=submitticket type 'totam' in the subject form and it will suggest articles. I want them to then be able to click the link and hopefully not need to post a ticket!

                    minLength: 3,
                    appendTo: ".with_ticket",
                    position: { my: "left bottom", at: "left top"},
                    source: function(request, response) {
                        $(document).blestaRequest('POST', '<?php echo $this->Html->safe($this->base_uri . 'plugin/support_manager/admin_tickets/searchbycode/');?>',
                            { _csrf_token: $('#tickets').find('input[name=_csrf_token]').val(), search: request.term},
                            function(data) {
                                if (data && data.tickets) {
                                    // Build the response to show
                                    var tickets = new Array();
                                    for (var id in data.tickets)
                                        tickets.push({label:data.tickets[id], value:data.tickets[id], id:id});

                                    // No results
                                    if (tickets.length == 0)
                    select: function(event, ui) {

I have tried using variations of this but I cant get it to work. I am probably missing something obvious, bit of a newbie!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now