Page 1 of 1
Preload Category
Posted: Tue May 12, 2009 6:32 am
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
Posted: Tue May 12, 2009 7:22 am
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).
Preload Category
Posted: Tue May 12, 2009 6:10 pm
by AndrewGW
Works perfectly, thanks
Andrew
Posted: Wed Aug 19, 2009 11:53 pm
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
Posted: Thu Aug 20, 2009 6:58 am
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']);
}
Category ID
Posted: Thu Aug 20, 2009 1:17 pm
by AndrewGW
Thanks Klemen,
I'll try that code.
Cheers,
Andrew