Preload Category

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
AndrewGW
Posts: 4
Joined: Tue May 12, 2009 6:20 am

Preload Category

Post by AndrewGW »

Script URL:www.selectsmallhotels.com/support/index.php
Version of script: 2.0

Write your message below:

Is there any way to preload the Category when linking into the page:
.../index.php?a=add

I want to use the system as a communications tool so clients can contact any of the member hotels and it would lessen confusion if I could add the category into the link off each hotel's contact page.

Cheers,
Andrew
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Try editing the index.php file (the one in the main Hesk folder) - open it in Notepad, find lines 156-157 which say

Code: Select all

<td width="80%"><select name="category">
<?php
.

Just below the <?php paste this code:

Code: Select all

    if (!isset($_SESSION['c_category']))
    {
    	if (!empty($_GET['catid']))
        {
        	$_SESSION['c_category'] = intval($_GET['catid']);
        }
    }
Then you should be able to use something like this to have a default category selected:
.../index.php?a=add&catid=123
where 123 is the category ID you want selected.

You can find category ids for example in the admin panel under "Categories" by looking in the URL linked to arrow images that are used to move categories up and down (catid parameter in the URL).
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
AndrewGW
Posts: 4
Joined: Tue May 12, 2009 6:20 am

Preload Category

Post by AndrewGW »

Works perfectly, thanks

Andrew
AndrewGW
Posts: 4
Joined: Tue May 12, 2009 6:20 am

Post by AndrewGW »

Script URL:www.selectsmallhotels.com/support/index.php
Version of script: 2.1

With reference to this code change to preload the category - it worked great in 2.0, when I upgraded to 2.1 today, I added the same code into the index.php file in 2.1 but it doesn't work - it seemed to work the first time I clicked on a link but now it just stays on that category, it doesn't change to the right category as per the catid number in the link.

I added the code after line 165 in the index.php file of version 2.1

Any ideas?

Thanks,
Andrew
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

It does work, but the HESK remembers the choice for the session (if you close all browser windows and try it again it will work again).

To change it every time you can try using this code instead:

Code: Select all

if (!empty($_GET['catid']))
{
	$_SESSION['c_category'] = intval($_GET['catid']);
}
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
AndrewGW
Posts: 4
Joined: Tue May 12, 2009 6:20 am

Category ID

Post by AndrewGW »

Thanks Klemen,
I'll try that code.
Cheers,
Andrew
Post Reply