RedJumpsuit

jobberBase custom development and support

 

Code School

Editing Salary Range in Admin

this is a follow-up post to the original Salary Range mod that a wrote some time back. if this is your first time to read about the Salary Range mod, please see the original post:

http://www.redjumpsuit.net/2009/04/09/add-salary-range-when-posting-jobs/

tonight i had the time to revisit the code and saw that you can’t actually edit the ads without error from the admin panel. that’s because the new variables were not added on the admin template and declared on the php file.

so anyway, here is the continuation of that original mod. this should be pretty easy if you’ve already followed the tutorial. with this you should be able to update the ad from the admin with the salary range mod without errors.

open /admin/page_edit_post.php, and before the lines

$jobToEdit['textiledDescription'] = $textile->TextileThis($_POST['description']);
$jobToEdit['location_outside_ro'] = $jobToEdit['location_outside_ro_where'];

add the following:

$jobToEdit['salaryfrom'] = $_POST['salaryfrom'];
$jobToEdit['salaryto'] = $_POST['salaryto'];
$jobToEdit['salaryper'] = $_POST['salaryper'];

and after this block

$data = array('company' => $company,
	  'url' => $url,
	  'title' => $title,
	  'city_id' => $city_id,
	  'category_id' => $category_id,
	  'type_id' => $type_id,
	  'description' => $description,
	  'location_outside_ro_where' => ($isCitySelected ? '' : $location_outside_ro_where) ,
	  'apply' => '',
	  'poster_email' => $poster_email,

add the following

          'salaryfrom' => $salaryfrom,
	  'salaryto' => $salaryto,
	  'salaryper' => $salaryper,

then open up /admin/_templates/edit-post.tpl and under these lines

			</table>
		</div><!-- #textile-suggestions -->
	</td>
</tr>

add the following

<!-- Salary Range -->
<tr>
<td class="publish-label" valign="top">{$translations.publish.salary_range}:</td>
<td>{$translations.publish.currency} <input type="text" name="salaryfrom" id="salaryfrom" tabindex="5" size="5" maxlength="10" value="{if $job.salaryfrom}{$job.salaryfrom}{else}{$smarty.post.salaryfrom}{/if}" /> to
<input type="text" name="salaryto" id="salaryto" tabindex="6" size="5" maxlength="10" value="{if $job.salaryto}{$job.salaryto}{else}{$smarty.post.salaryto}{/if}" /> per
<select name="salaryper" tabindex="7">
	<option value=""></option>
	<option value="Hour"{if $job.salaryper == "Hour" || $smarty.post.salaryper == "Hour"} selected{/if}>Hour</option>
	<option value="Week"{if $job.salaryper == "Week" || $smarty.post.salaryper == "Week"} selected{/if}>Week</option>
	<option value="Month"{if $job.salaryper == "Month" || $smarty.post.salaryper == "Month"} selected{/if}>Month</option>
	<option value="Year"{if $job.salaryper == "Year" || $smarty.post.salaryper == "Year"} selected{/if}>Year</option>
</select><br />
<div class="suggestion">
{$translations.publish.currency_warning}
</div>
</td>
</tr>
<!-- /Salary Range -->

this should take care of editing the job ad on your admin page.

6 Comments

Code School

  1. Hi, first of all thanks for the code and i hope you are continuing the paypal mod depite the new version released by Jobber base, i am looking forward to it.

    I was hoping you could shed some light on where i may have went wrong with the salary mod. Baiscally when selecting post a job the form only displays up to where the salary boxes should be. In admin the form displays correctly however when you review the job post the following error is recieved. You can view the board at the given website address.

    PHP Error Message
    Fatal error: Smarty error: [in job-details.tpl line 117]: syntax error: unrecognized tag ‘literal’ (Smarty_Compiler.class.php, line 580) in /home/a5012622/public_html/_includes/smarty/libs/Smarty.class.php on line 1088

    The only things that i can think of that may have contributed was that during the first section of this turorial where is says to add before the line NOW(), 1, 0, 0,

  2. Hi again, with regards to my earlier post i have solved the problem now.

    Saby

  3. hi! glad you got it solved 😉 u were quicker than me!

  4. I’ve added the Salary mod, and it’s great! I was just wondering if there is a way to display the salary or starting salary on the front page? Where it lists the “Most Recent Job Offers’?

  5. yes you could include the salary on the list of jobs, you just need to display the salary variables like that in the details page.

Trackbacks

  1. RedJumpsuit (Non-Apparatus) » Blog Archive » Add Salary Range when posting jobs

Leave a Response