Page 1 of 1

category name in emails

Posted: Tue Apr 20, 2010 8:42 pm
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

Posted: Fri Apr 23, 2010 4:20 pm
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.

Posted: Sat Jun 12, 2010 8:30 am
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?

it was working mint

Posted: Thu Jul 01, 2010 1:10 am
by slcomputing
but now it has dropped with version 2.2 - any ideas why? thanks for your help

Posted: Sat Jul 03, 2010 5:40 pm
by Klemen
It should still work, but instead of $all_cat[$category] try using $all_cat[$tmpvar['category']]