Silverstripe 3.3循环循环不获取值

Good morning,

Im struggling with a loop that is not working. I want to generate a xml file by looping through some products, 5 in my case. I've got the products in an arraylist and they show up as expected but then I want in that loop to loop through another arraylist with cars for that product. And thats where my problem is.

    <% loop $getProducts %>
        <% loop $getCars($ID) %>
            <item>$ID</item>
        <% end_loop %>
    <% end_loop %>

This is my template file with the loops im talking about. $getProducts is working, if I print the $ID in the getProducts loop its working good. But $getCars is empty and just showing < item >< /item >

The functions in the controller are those.

public function getProducts() {
    return GoogleShoppingFeed::mergeProductsAutos();
}

public function getCars($productID) {
    return GoogleShoppingFeed::getCarsByProduct($productID);
}

The function mergeProductsAutos is working fine.

public static function getCarsByProduct($productID = null) {
    if($productID) {
        switch($productID){
            case 127: 
                return self::$example1;
                break;
            case 126: 
                return self::$example2;
                break;
            case 781:
                return self::$example3;
                break;
            case 2924:
                return self::$example4;
                break;
            case 993:
                return self::$example5;
                break;
            case 5195:
                return self::$example6;
                break; 
        }
    } else {
        return false;
    }
}

This function should return the filled arrayLists, they're correctly filled so there is not the problem.

Sorry for my terrible english but I hope someone can help me! Thanks.

Problem solved.

    <% loop $getProducts %>
        <% loop $Up.getCars($ID) %>
            <item>$ID</item>
        <% end_loop %>
    <% end_loop %>