category name in emails

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
slcomputing
Posts: 2
Joined: Tue Apr 20, 2010 8:32 pm

category name in emails

Post by slcomputing »

Script URL:
Version of script:2.1
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

hey guys i'm new here i've had a look around the forums and can't seem to find an answer so i thought i'd post a new topic, how can i get the email to show the category name instead of the category id - preferably in the subject but could handle it being in the body of the message.

i really appreciate your support and i'ts a great package

Steven
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

You'll need to use something like this to get all the category names:

Code: Select all

$all_cat = array();

$sql = 'SELECT `id`,`name` FROM `'.hesk_dbEscape($hesk_settings['db_pfix']).'categories` ORDER BY `cat_order` ASC';
$res = hesk_dbQuery($sql);
while ($row=hesk_dbFetchAssoc($res))
{
	$all_cat[$row['id']] = $row['name'];
}
Then you have all the categories names stored in an array. Echoing $all_cat[1] will print the name of the default category. In the submit_ticket.php you could use $all_cat[$category] to access the current category name.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
l00ph0le
Posts: 5
Joined: Tue Aug 15, 2006 8:18 pm

Post by l00ph0le »

Sorry to be a pain, but I am a little lost on where to place this query and how to call it to put the category into the subject line of the e-mail?
slcomputing
Posts: 2
Joined: Tue Apr 20, 2010 8:32 pm

it was working mint

Post by slcomputing »

but now it has dropped with version 2.2 - any ideas why? thanks for your help
Klemen
Site Admin
Posts: 10145
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

It should still work, but instead of $all_cat[$category] try using $all_cat[$tmpvar['category']]
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply