Hi there,
I’m modifying a theme’s collection/show page so that top-level collections are differentiated from child collections in their formatting. Top-level collections display a grid of child collections and child collections display items in a grid. In order to return metadata on a collection I have re-used the function presented in the old forum topic ‘Collection Tree: getting child collections’.
This function seems to work fine except when I try to call get_collection_by_id whereupon I get …
Fatal error : Call to undefined function get_collection_by_id()
… my code is as follows …
function Leeds_GATE_get_child_collections($collectionId) {
if(plugin_is_active('CollectionTree')) {
$treeChildren = get_db()->getTable('CollectionTree')->getChildCollections($collectionId);
$childCollections = array();
foreach($treeChildren as $treeChild) {
echo '<li class="collection record">';
$linkid = ($treeChild['id']);
$linktext = ($treeChild['name']);
echo "<a href='$linkid'>$linktext</a>";
echo '<div class="img">';
get_collection_image($linkid);
echo '</div>';
echo '</li>';
Causes error -----------> $childCollections[] = get_collection_by_id($treeChild['id']);
}
return $childCollections;
}
return array();
}
$collectionId = metadata('collection', 'id');
Leeds_GATE_get_child_collections($collectionId);
… I know the function is partly working as it is able to echo back data in the ‘CollectionTree’ table.
Any help would be appreciated.
Stephen