I've problem sorting out Job ID. I've Jobs in different department and in each department, the jobs have to be sorted out in order of importance. I I've tried the following but its still not sorting.
{cms_module module="Jobs" sortby="job_id"}
{cms_module module="Jobs" sortby="job_hrid"}
{cms_module module="Jobs" sortby="jobs_id"}
{cms_module module="Jobs" sortby="jobs_hrid"}
I've checked the table in the database and figured out that the ID field is called "hrid". Hence I tried the above, but yet its still not working. Can anyone help by checking out if I got it right. I've found this post. http://forum.cmsmadesimple.org/index.ph ... 386.0.html but apparently still not working for me. Is due to the jobs in different department? Does anyone have the same problem?
[SOLVED] Jobs Module : Sorting out Job ID
[SOLVED] Jobs Module : Sorting out Job ID
Last edited by Anonymous on Thu Feb 07, 2008 8:35 am, edited 1 time in total.
Re: Jobs Module : Sorting out Job ID
I haven't got the Jobs module installed, but from what I read in the source, it might be that you have to include the table name in which the field resides. So have you tried something like:
{cms_module module="Jobs" sortby="mn.job_id"}
What helps me sometimes is to include a debug statement. I hope you are a bit familiar with PHP
.
Insert after line 134 in action.default.php the following:
echo 'DEBUG: result = '.$db->ErrorMsg().' '.$db->sql.''; #die();
Save and run again. This will return in the front end the sql query used. Maybe you can derive an error from the statement generated.
Succes.
{cms_module module="Jobs" sortby="mn.job_id"}
What helps me sometimes is to include a debug statement. I hope you are a bit familiar with PHP

Insert after line 134 in action.default.php the following:
echo 'DEBUG: result = '.$db->ErrorMsg().' '.$db->sql.''; #die();
Save and run again. This will return in the front end the sql query used. Maybe you can derive an error from the statement generated.
Succes.
[SOLVED] Re: Jobs Module : Sorting out Job ID
That really helps! Thank you sooo much for the tip. No, I am not familiar with PHP, still figuring out. Anyway, as I am not sure if there is anything wrong with the SQL syntax. I went to execute the query in mySQL and the result doesnt sort out until i removed the ' ' in between job_hrid. Next, I've checked the PHP in action.default.php and remove the ' ' in line 96. It work!! 
I am not sure if this is the correct way of doing things though, but it work for me. My ID is sorted out by numbers and I've tried to sort out by alphanumeric as well and it works. is Here is the code for all to see.
In line 96, of action.default.php, remove ' ' in between:
$query .= "ORDER BY '" . str_replace("'", '', str_replace(';', '', $params['sortby'])) . "' ";
it should read something like the one below:
$query .= "ORDER BY " . str_replace("'", '', str_replace(';', '', $params['sortby'])) . " ";
The param remain as:
{cms_module module='Jobs' sortby='job_hrid'}
Not sure why it work this way but any PHP guru reading this might want to explain.
din

I am not sure if this is the correct way of doing things though, but it work for me. My ID is sorted out by numbers and I've tried to sort out by alphanumeric as well and it works. is Here is the code for all to see.
In line 96, of action.default.php, remove ' ' in between:
$query .= "ORDER BY '" . str_replace("'", '', str_replace(';', '', $params['sortby'])) . "' ";
it should read something like the one below:
$query .= "ORDER BY " . str_replace("'", '', str_replace(';', '', $params['sortby'])) . " ";
The param remain as:
{cms_module module='Jobs' sortby='job_hrid'}
Not sure why it work this way but any PHP guru reading this might want to explain.
din
Last edited by Anonymous on Thu Feb 07, 2008 8:36 am, edited 1 time in total.