Hi, I have a 2 level site structure for products like this:
Die Cast Toys
----Pull Back Vehicles
----Free Wheel Vehicles
----Guns
etc
When I am on a child page , ie Pull Back Vehicles I currently have all the dataobjects listing no probs see here
I am using this code to do it:
#####in ProductPage.php#########
//get Product dataobjectset ready for pagination
function ProductItems() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "Product",
$filter = "`ProductPageID` = '".$this->ID."'",
$sort = "",
$join = "",
$limit = "{$SQL_start},15"
);
return $doSet ? $doSet : false;
}
What I am having trouble with is figuring out how to get ALL child dataobjects. So if I go to 'Die Cast Toys' I need to see all dataobjects from the 3 child pages.
I'm not sure if I need to find and then loop through all the child id's within a function??? or some other way....
function AllChildProductItems() {
if(!isset($_GET['start']) || !is_numeric($_GET['start']) || (int)$_GET['start'] < 1) $_GET['start'] = 0;
$SQL_start = (int)$_GET['start'];
$doSet = DataObject::get(
$callerClass = "Product",
##### find and loop here???? ######
$filter = "`ProductPageID` = '".$this->ID."'",
###########################
$sort = "",
$join = "",
$limit = "{$SQL_start},15"
);
return $doSet ? $doSet : false;
}
Thanks for any suggestions in advance!!