Zoo - one of the most popular Joomla extension has a view which shows just a single record, that is of course full view. Zoo doesn't have a view which shows a list of records of particular submission type. So what if you want to show a list of zoo items of particular type in your extension.
You must be thinking what's the big deal, based on submission id just fetch the records & show it how you want. Wait a minute. Its not as easy as you think as Zoo uses JSON method to store record's which is quite difficult to render zoo elements. So its quite complicated to get zoo items details from database by executing queries.
Even if you manage it won't be robust cause to get related records from table you have to deal with hard coded 36 key string, which zoo uses as field identifier. So lets get away from this hassle.
Here is the snippet to render the details of zoo records quite easily.
You must be thinking what's the big deal, based on submission id just fetch the records & show it how you want. Wait a minute. Its not as easy as you think as Zoo uses JSON method to store record's which is quite difficult to render zoo elements. So its quite complicated to get zoo items details from database by executing queries.
Even if you manage it won't be robust cause to get related records from table you have to deal with hard coded 36 key string, which zoo uses as field identifier. So lets get away from this hassle.
Here is the snippet to render the details of zoo records quite easily.
$zapp = App::getInstance('zoo'); $items = $app->table->item->all(array('conditions' => 'id = '.$Zoo_Item_id)); //$Zoo_Item_id must be zoo item id of which you want to render details foreach($items as $item) { foreach ($item->getElements() as $id => $element) { echo $element->render();Here you can see how we are showing Zoo related records in table. We have added link for full view of respective Zoo Item as well.
} }