I am at wits end - How do I access the ZOO item_id in a form outside of ZOO? Is the Event Plug-in broken?
I have lost what little hair I have left trying (for over seven hours) to figure this out.
I have a ZOO item (name of product) I would like to display inside a form (BreezingForm). While I can access the element data from within ZOO using the element id I cannot figure out how to access the element from outside of ZOO (inside the form). The stumbling block appears to be I cannot access the ZOO item_id outside of ZOO iteself.
Using the code found in the documentation:
// load ZOO config require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php'); // Get ZOO App instance $zoo = App::getInstance('zoo');
does not allow me to access the ZOO information needed. The code which works (when hard coded in the full.php renderer) is:
<?php // load ZOO config require_once(JPATH_ADMINISTRATOR.'/components/com_zoo/config.php'); // Get ZOO App instance $zoo = App::getInstance('zoo'); $item = $this->app->table->item->get($item->id); $element_value = $item->getElement('2e3c9e69-1f9e-4647-8d13-4e88094d2790')->getElementData()->get('value'); echo $element_value; ?>
Unfortunately, this code brings up null errors when ported over to the form. After extensive testing I believe the $item variable is not coming through.
So, to sum up I have code that will work if placed directly inside ZOO but not if I have it embedded in a form on the same page. The ZOO Event Plug-in doesn't seem to work for me.
I really, really need this to work and cannot understand what I am doing wrong. Any help is greatly appreciated.
Thank you for your guidance, it is (really) appreciated.
Upon reflection, I think I may be missing some fundamental understanding of how a zoo variable works. My intent is to display a ZOO item at the top of a page and then in a separate module at the bottom of the same page (outside of the ZOO application) show content from within the ZOO application above.
The stumbling block appears to be centered around the Item ID number.
While I am able to identify and display the necessary Item ID within the ZOO application (at the top of the page) I am unable to transfer/copy that Item ID into a module (outside of ZOO) at the bottom.
My previous code (which you helped with) was intended to pluck the Item ID needed from the ZOO application at the top for use (outside of ZOO) at the bottom. With your reply, I now realize that I was creating a new ZOO instance which returned the Boolean error and not the item ID from above.
So, the question has now morphed into:
‘How do I transfer/copy a ZOO Item ID number from the application to a module outside of the application on the same page?’
If useful I am happy to create a temporary website with a ZOO application to more clearly show my intent. Please let me know.