I am working on customising Open Classifieds for a job site. As a result I need to add two new fields - job hours (full time or partime) and job duration (permanent or temporary).
I added the fields to the database, created new function entries in common.php, added definitions to config.php and then modifed new/index.php, manage/index.php and item.php to show the new fields. I also changed htaccess to get the SEO friendly URLs to work.
I have run into two problems - problem 1 is that no matter what I choose from the dropdowns for the two new fields it will only ever display the items with a value of 1 (for example, duration value 0 is permanent, duration value 1 is temporary) and even when I choose 0/permanent it shows temporary.
The second problem is with htaccess where it wants to try and add the tmeporary and part time tag to the url which then means it wont work - for example on the home page I see a job called /4/Jobs%20Wanted/oven-cleaning-jobs-wanted/test but when I edit or post the job the link shown on the page tries to go to /4/Jobs%20Wanted/Temporary/Part Time/oven-cleaning-jobs-wanted/test and that won't work.
Any ideas how to overcome the problems?
Thanks
Jason
Hello Jason,
My reccomendation to you and the easier one is to change the fields type and add your owns.
Since I can't help to you too much if I didn't make the changes.
About the .htaccess the url need to use the function u() or friendly_url to parse it to a good name.
regards
Hi Chema,
I used the field "type" and searched the above files for all references to it and then added new references using type as a template and changed it accordingly to reflect the new fieldnames but am still getting problems.
Jason
Got to the bottom of it :)
In item.php I was trying to use "getDurationName($duration)" but $duration was not a recognised value - when I looked in controller.php I realised I had actually defined itemDuration and when I changed the query to that it was all sorted.
The issue with the URL's was caused by me adding the additonal fields in places where they were not needed in manage.php around the FRIENDLY_URL definition.
Now off to look at advanced searching :)
Great!
For advanced search check the form in common.php and the query at controller.php
regards
I have added the fields to common.php so they show on the search form but how do I create the query in controller.php? Is it just:
[code]
if (cG("duration")=="permanent"){
$filter.= " and p.duration=1";
} else if (cG("duration")=="temporary"){
$filter.= " and p.duration=0";
}
if (cG("hours")=="fulltime"){
$filter.= " and p.hours=1";
} else if (cG("hours")=="parttime"){
$filter.= " and p.hours=0";
}
[/code]
Yes in the if for the search, but is as you say I think.
This topic has been closed to new replies.