×

Notice

The forum is in read only mode.

User Fields in Jobs not working. SERIOUS ISSUE!

14 years 4 months ago #1029 by Ahmad
Hi,

Problem in view user fields (in select case)

Please add this method in model class
function &getUserFieldsForView($fieldfor, $id)
	{
		$db = &$this->getDBO();
		//if (isset($id) == false) return false;
		$result;
		//if (is_numeric($id) == false) return $result;
		$field = array();
		$result = array();
		$query =  \"SELECT  * FROM \".$db->nameQuote(\'#__js_job_userfields\').\" 
					WHERE published = 1 AND fieldfor = \". $fieldfor;
		$db->setQuery($query);
		$rows = $db->loadObjectList();
		
		$i = 0;
		foreach ($rows as $row){
			$field[0] = $row;
			if ($id != \"\"){
				$query =  \"SELECT  * FROM \".$db->nameQuote(\'#__js_job_userfield_data\').\" WHERE referenceid = \".$id.\" AND field = \". $row->id;
				$db->setQuery($query);
				$data = $db->loadObject();
				$field[1] = $data;
			}
			if ($row->type == \"select\"){
				$query =  \"SELECT  value.* FROM \".$db->nameQuote(\'#__js_job_userfieldvalues\').\" value
				JOIN \".$db->nameQuote(\'#__js_job_userfield_data\').\" udata ON udata.data = value.id
				WHERE value.field = \". $row->id;
				$db->setQuery($query);
				//echo \'<br> sql \'.$query;
				$value = $db->loadObject();
				$field[2] = $value;
			}
			$result[] = $field;
			$i++;
		}
		return $result;
	}

Please replace this line in getCompanybyId method
$result[2] = $this->getUserFields(1, $companyid); // company fields, id

With
$result[2] = $this->getUserFieldsForView(1, $companyid); // company fields, id

And also replace this line in getJobbyId method
$result[2] = $this->getUserFieldsForView(2, $job_id); // company fields, id
With
$result[2] = $this->getUserFieldsForView(1, $companyid); // company fields, id

Please edit view_company.php and view_job.php
Replace this line
if(isset($ufield[1])){ $fvalue = $ufield[1]->data; $userdataid = $ufield[1]->id;} else {$fvalue=\"\"; $userdataid = \"\"; }

With
if ($userfield->type != \"select\"){
if(isset($ufield[1])){ $fvalue = $ufield[1]->data; $userdataid = $ufield[1]->id;} else {$fvalue=\"\"; $userdataid = \"\"; }
}elseif ($userfield->type == \"select\"){
if(isset($ufield[2])){ $fvalue = $ufield[2]->fieldvalue; $userdataid = $ufield[1]->id;} else {$fvalue=\"\"; $userdataid = \"\"; }
}

Please write your valuable review JS Jobs and JS Support Ticket at JED.
14 years 4 months ago #1030 by soamz
So, all this changes to happen on the models/jsjobs.php file only ?
14 years 3 months ago #1096 by soamz
14 years 3 months ago #1097 by soamz
Ahmad, its not working at all. If I do the above changes, then the whole custom fields display are just gone from the frontend view job page.

Can you please look into it personally, if I send you the login details ?
Please, its a bit of urgency.
Thanks.. :(
14 years 3 months ago #1101 by Ahmad
Please download latest version and check how it work.
If you still have problem send me information in email.

Please write your valuable review JS Jobs and JS Support Ticket at JED.
Time to create page: 0.067 seconds

Please publish modules in offcanvas position.