There are lots of question that asking about how to add extra or new fields into the open ticket form and display them onto the viewticket page in osTicket System. One of the questions that you can see is by clicking on this link. This following modification was being made by myself to answer such question. In this example, we will add set of checkboxes that contains of 5 checkboxes, plus one textbox, and groupped them into two additional fields (applications and productkey), onto the form on the client-side. We will make it also for the staff-side in the separate article, later.
-
First of all, alter your ost_ticket table, by adding two new fields: applications and productkey. You may use this following SQL script (please note that ost_ is the table prefix name, in case it differents with yours, adjust it by yourself):
ALTER TABLE ost_ticket ADD COLUMN `applications` varchar(100) default '' NOT NULL, ADD COLUMN `productkey` varchar(50) default'' NOT NULL;
-
Open your \include\client\open.inc.php file, and find this code:
95 96
<? } }?>
after the last line of that code, please insert this following code:
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
<tr> <td>Applications: </td> <td> <input name=applications[] type=checkbox value="Application 1" >Application 1 <input name=applications[] type=checkbox value="Application 2" >Application 2 <input name=applications[] type=checkbox value="Application 3" >Application 3 <input name=applications[] type=checkbox value="Application 4" >Application 4 <input name=applications[] type=checkbox value="Application 5" >Application 5 </td> </tr> <tr> <td>Product Key: </td> <td> <input type="text" name="productkey" size="35" value="<?=$info['productkey']?>"> </td> </tr> -
Open your \include\class.ticket.php file, and find this code:
44
var $overdue;
after that line, please insert this following code:
45 46
var $applications; var $productkey;
Find again this code:
88
$this->overdue =$row['isoverdue'];
then replace with this following code:
88 89 90
$this->overdue =$row['isoverdue']; $this->applications =$row['applications']; $this->productkey =$row['productkey'];
Find again this code:
140 141 142
function getSubject() { return $this->subject; }
after the last line of that code, please insert this following code:
143 144 145 146 147 148 149
function getApplications() { return $this->applications; } function getProductKey() { return $this->productkey; }
Find again this code:
1107
$fields['message'] = array('type'=>'text', 'required'=>1, 'error'=>'Message required');
after that line, please insert this following code:
1108 1109
$fields['applications'] = array('type'=>'text', 'required'=>0, 'error'=>'Applications required'); $fields['productkey'] = array('type'=>'text', 'required'=>0, 'error'=>'Product key required');
Find again this code:
1197 1198 1199
Sys::alertAdmin('Overlimit Notice',$msg); } }
after the last line of that code, please insert this following code:
1201 1202 1203 1204 1205 1206 1207
$mycounter=0; foreach ($var['applications'] as $app) { $strapp .= ($mycounter==0)?$app:", ".$app.""; $mycounter++; } unset($app);
Find again this code:
1260
',ip_address='.db_input($ipaddress).
then replace with this following code:
1260 1261 1262
',ip_address='.db_input($ipaddress). ',applications='.db_input($strapp). ',productkey='.db_input($var['productkey']).
-
Open your \include\client\viewticket.inc.php file, and find this code:
27 28 29 30
<tr> <th>Create Date:</th> <td><?=Format::db_datetime($ticket->getCreateDate())?></td> </tr>after the last line of that code, please insert this following code:
31 32 33 34
<tr> <th>Applications:</th> <td><?=$ticket->getApplications()?></td> </tr>Find again this code:
43 44 45 46
<tr> <th>Phone:</th> <td><?=Format::phone($ticket->getPhoneNumber())?></td> </tr>after that line, please insert this following code:
47 48 49 50
<tr> <th>Product Key:</th> <td><?=$ticket->getProductKey()?></td> </tr>
That’s all. Hopefully this will be helpful.

Hello,
I followed your excellent guide and added more fields in client area. What should I do showing new custom fields in admin area ?
link could be like this one …/support/scp/tickets.php?id=10
thank you very much
Hi Antony,
I will create that modification, too. So, stay tuned!
This site is an astonishingly good resource!
Just ‘Thank you’
Mike
Hi masino, when i edit the code, it seems working but found one bug… when user is already online (log in to view his ticket), when he clicks on open new ticket again, it seems the templates got error .. it is not loading the correct / full templates.. can you recheck on this ?
thanks
Hi Masino,
where can i find the tutorial about scp part, i have folowed the turtorial above, but can not find the info in the scp part.
thanks
bjorn
the fields dont show for the support persion when opening the ticket
i have customers who tested this and put license keys in
but when admin or staff view ticket it does not appear
please help