Parsing http://website/index.php?/Tickets/Submit/RenderForm/4 with SUBJECT (need help)

Discussion in 'Developing, APIs and extending' started by sniper, Aug 29, 2012.

  1. sniper

    sniper Established Member

    Hello,

    In V3, I was able to Parse the URL and was able to prefill the SUBJECT of an email from the URL

    It used to be like this


    http://website/index.php?_m=tickets&_a=submit&departmentid=3&step=1&subject=SUBJECT=texthere

    As you can see from the example above, it would go straight to Department ID 3, step 1, and fill out the subject with the text after Subject= "texthere"

    In V4. I have figured out you can go straight to a department with

    http://website/index.php?/Tickets/Submit/RenderForm/4

    which goes to department 4

    But I am looking for

    http://website/index.php?/Tickets/Submit/RenderForm/4&subject=SUBJECThere

    So that when the above URL is used

    It will go straight to Department #4, and fill out the SUBJECT with the text after "subject="

    can anyone help with the coding to do this and where?

    I find this useful because I am able to fill out the subject with a Dynamic text string on my web pages, and find out what the customer is emailing about, the page name, or product #. This saves a lot of time.

    Can anyone help?
  2. Gary McGrath

    Gary McGrath Kayako Staff Staff Member

    Hi there,

    This can be done, but it will require editing the base code to pull through your extra values, I will walk you through an example

    The URL we will be using on the client side is:

    http://helpdesk.com/index.php?/Tickets/Submit/RenderForm/2/myticketsubject

    To get this pulling though, first we need to edit a file detailed below

    Kayako version: 4.50.00
    file name:class.Controller_Submit.php
    location: __apps\tickets\client

    Near line 143, you will find this:

    Code:
     
     public function RenderForm($_departmentID = false) {
     
    
    We need to add our new ticketsubject variable to this, like so:

    Code:
     
     public function RenderForm($_departmentID = false, $_miskValue = '') {
     
    
    Then we need to bring that new variable into our template, near like 177, you will find this:

    Code:
     
    $this->Template->Assign('_promptTicketPriority', false);
     
    
    We need to add a new assign for our variable, so just above that line, add this:

    Code:
            $this->Template->Assign('_miskValue', $_miskValue);
    
    Ok, thats the end of the code changes, we now need to edit our template to use the new value like so:

    find this line in the submitticket template:

    Code:
     
    <input name="ticketsubject" type="text" size="45" class="swifttextwide" id="ticketsubject" value="<{$_ticketSubject}>" />
     
    
    And change it to use our new variable instead:

    Code:
     
    <input name="ticketsubject" type="text" size="45" class="swifttextwide" id="ticketsubject" value="<{$_miskValue}>" />
     
    
    you could also change the input to use the "hidden" tag, so the end user does not even see the subject box at all, but in that case, you would always have to ensure the subject contained something, else users would be unable to sumbit tickets. ( to do that, right at the top on the public function where we have $_miskValue = '', you would just put something in it by default, e.g. $_miskValue = 'n/a'

    Gary

Share This Page