Hello,
I have ProductPages which has many ProductImages.
I can get 3 random Product Page with the following code
function RandomProductPages($num=3) {
return DataObject::get("ProductPage", "", "RAND()", "", $num);
}
I can also get random ProductImages with the following code :)
function RandomProductImage($num=1) {
return DataObject::get("ProductImage", "", "RAND()", "", $num);
}
How to combine them, so that I can get 3 random product pages with 1 random image for each? :)