Zoo - Techjoomla Blog to programativally insert links, Techjoomla.com

Zoo from the YooTheme guys is a pretty awesome CCK for Joomla with some mind-blowing features. Whats more, they have made it extremely easy to use for the end user. It can be easily scaled to handle all kinds of content management situations that you might encounter.

It's so flexible, in fact.. that we have used it for Variety of applications using Shopping Carts (with Quick2Cart Integration), Online Product Catalogs, Download Managers, Business directories & what not

In the course of using Zoo, we have had to customize it extensively & build custom applications on top of it to enhance the customer experience. This blog launches a series where we shall tips & tricks of best using the Zoo API & generally developing around Zoo.

Developing With Zoo - Learn to programmatically create Edit Item links

It can be quite tricky to figure out how Zoo constructs its "Edit Item" links based on the Zoo item id unless you know how exactly zoo constructs hashes.  If you use the ZOO API, this can be very easy.

You just need to pass submission type of zoo item & zoo item id itself to the getSubmissionHash API which returns you respective hash for the item. 

$zapp = App::getInstance('zoo'); 
$items = $zapp->table->item->all(array('conditions' => 'id =$zoo_item_id)); 
// $zoo_item_id must be zoo record id which you want to edit. 
$type = $items[$item->id]->type; 
// get submission type of item 
$hashRelated = $zapp->submission->getSubmissionHash(1,$type, $item->id); 
// Here is the exact hash for the record 

$href = JRoute::_(JURI::Base()."index.php?option=com_zoo&view=submission&layout=submission&submission_id=1&type_id=$type&item_id=$item->id&submission_hash=$hashRelated"); // Construct link as zoo 
echo 'Edit Record';