Hi guys,
I'm stuck :-( i think it's quite simple, yet i have spend most of my day trying to figure it out.
I have different CourseHolders, that each have several child pages of the type CoursePage.
The CourseHolder lists CoursePages that are children of it self, with the following function (pagination is used)
UPDATE: The code below works - problem is making the CustomSearchCOntext work with the ParentID filter.
public function getGroupCoursesList() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$CoursesList = DataObject::get(
$callerClass = "Course",
$filter = "ParentID = '". $this->ID . "' AND StartDate > CURDATE()",
$sort = "StartDate ASC",
$join = "",
$limit = "{$SQL_start},10"
);
return $CoursesList;
}
I have a custom search on the CourseHolder pages, that should allow the user to filter the list by, city and a date.
The problem is i can not make the custom search context filter the results to only contain children of the current page, it returns all my Courses across all CourseHolder pages.
I have tried adding hidden fields to the form, modifying the query: $query->where('"ParentID" = 11'); editing the $searchCriteria and everything else i could think of, but no luck - PLEASE HELP!
Code that generates the form (in the controller of CourseHolder.php): http://www.sspaste.com/paste/show/501be687b44ad
Complete code of the CoursePage.php: http://www.sspaste.com/paste/show/501be8ecad0b1