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 #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.

More
8 years 5 months ago #68917 by ggppdk
Hello

you can put the full code that you are using in a text file
and send it to me with a PM


-- 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 #68997 by ydl

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

More
8 years 5 months ago #68999 by ydl
I think I understand my issue....
I am trying to use the code in the administrator part and not in the front-end!

What do you say?

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

More
8 years 5 months ago #69001 by ggppdk
Hello

i have looked at it and updated the FAQ article
but it seems i was interrupted when i was writting an answer here

please use the exact code from the updated FAQ article


-- 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 - 8 years 5 months ago #69038 by ggppdk
Hello

is your custom code working now

also you can install this package :
github.com/FLEXIcontent/flexicontent-cck...ive/3.2.x-stable.zip

furthermore , if you still get an error, and your website online you can send me a PM with super admin access


-- 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 #69041 by ydl
no I don't have a working version... and even not after installing the last version (3.2.1-dev)...

The development is done on a local machine BUT we can share windows and talk on skype for example.... let me know if it possible

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