problem with "How to create a new FLEXIcontent item or update an existing item by calling the FLEXIcontent item model in custom code"

More
8 years 5 months ago #68788 by ydl
I follow the article and tried to get n existing item. in my component (salesforce connection)...

when called to '$item_model->getItem(764)' I am getting an error.
a short investigation lead me to 'ParentClassItem' line 490"
$item = $this->getTable();
Its return an empty $item....

what could be wrong?

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #68790 by ggppdk
Hello

we have updated our database model
to use a new base model.

i will retest the custom code suggested my our FAQ article to see if anything is broken


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
More
8 years 5 months ago #68891 by ydl
Do you have an estimation when the 'retest' will be done?
Thanks in advance

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #68892 by ggppdk
Hello

i think i can recheck it today

please ping me tomorrow morning,
if you receive no answer before that

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
More
8 years 5 months ago #68906 by ggppdk
Hello
Code:
$data['id']
needs also to be set
Code:
$data['id'] = $item_ID;

i will update instructions


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #68907 by ydl
BUT I don't understand ...
the problem was in the call:

$item = $item_model->getItem($item_ID, $check_view_access=false, $no_cache=true, $force_version=0);

so, how to fit what you write in this call

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago - 8 years 5 months ago #68908 by ggppdk
Hello

Just set it before calling model 's store()

i have updated the instructions:

www.flexicontent.org/documentation/faq/7...-in-custom-code.html
Code:
// 444 is the id of the item that you want to load, or set it to zero for new item $item_ID = 444; if ($item_ID) { // EITHER Load existing item into the ITEM model $item = $item_model->getItem($item_ID, $check_view_access=false, $no_cache=true, $force_version=0); // You can use $item to get existing values if (!$item) die('item '.$item_ID.' not found'); // IMPORTANT: Get existing field values for the item $items = array($item); $items_custom_values = FlexicontentFields::getCustomFieldValues($items, 'item'); $data['custom'] = reset($items_custom_values); // Get data of first item // Indicate which item to update $data['id'] = $item_ID; } else { // OR indicate a new item will be created $data['id'] = 0; }


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!
Last edit: 8 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
8 years 5 months ago #68916 by ydl
I think I am misunderstood...

The problem is when calling to

$item = $item_model->getItem($schoolId, $check_view_access=false, $no_cache=true, $force_version=0);

and I am getting the error:

Call to a member function load() on boolean...

So, this call is done before getting the 'item'....

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save