cjsmith87 Posted February 21, 2018 Report Posted February 21, 2018 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"> <?php $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;"> </div> </div> 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: <script> function loadKBArticles( value ) { $element = document.getElementById("matchingKB"); $element.style.display="block"; $element.innerText =<Similar KB Links Here>; } </script> 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 Quote
Michael Posted February 21, 2018 Report Posted February 21, 2018 I know you need to set it in the model to grab it by $text but that's as far as I know mate, as you only want to search bits @GosuHost @cyandark should be able to help mate. Quote
Tyson Posted February 21, 2018 Report Posted February 21, 2018 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. Michael 1 Quote
cjsmith87 Posted February 22, 2018 Author Report Posted February 22, 2018 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! $('#ticket_number').autocomplete({ 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}); response(tickets); // No results if (tickets.length == 0) $('#no_tickets').show(); else $('#no_tickets').hide(); } }, null, {dataType:'json'} ); }, select: function(event, ui) { $('#ticket_id').val(ui.item.id); } }); I have tried using variations of this but I cant get it to work. I am probably missing something obvious, bit of a newbie! Quote
Blesta Addons Posted February 24, 2018 Report Posted February 24, 2018 there are no native option to fetch articles in KB by keywords. normally you should add a new plugin or controller file in support manager to handle this request. Beav 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.