[SOLVED] update item with custom field

5 years 2 months ago #64810 by ggppdk
Hello


you need to set:
new data to
$data ARRAY (see the FAQ article)

any data you do not set will maintain their existing value
only use $item to get an existing value

$item = $itemmodel->getItem($area->id);
$data[...] = ...;  // see FAQ article
 
$itemmodel->store($data)


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

5 years 2 months ago #64868 by fopo-web
Hi,

Now it works. Thanks for your help.


Regards,

Frank

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

5 years 2 months ago #64954 by fopo-web
Hi, I thing I have found a bug in the flexicontent api.

I set some custom values like this and save the item.

$item = $value;

After saving, my other custom fields (which I have not modified) will be cleared. It will not be maintain with the exisiting value.

What can I do?

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

5 years 2 months ago #64957 by ggppdk
Hello

yes, we need to update the FAQ article about how to load the existing values into the data array,
before calling the save operation on DB model

i ll update it today or tommorow


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

5 years 2 months ago #64969 by fopo-web
Hi, do you have updated the FAQ?


regards,

Frank

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

5 years 2 months ago #64972 by ggppdk
Hello

try this it should work:
1. call
$data['custom'] = FlexicontentFields::_getCustomValues(array($item), 'item');

2. then change the values of $data

and post back here


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

5 years 2 months ago #64987 by fopo-web
Hi, thanks for your help, but it doesn't work.

The function returns the wrong structure:
"custom": {
    "359": {
      "15": [
        "value of 15"
      ],
      "20": [
        "value of 20"
      ],
      "21": [
        "value of 21"
      ],
     ....

regards,

Frank

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

5 years 2 months ago #64999 by ggppdk
Hello

indeed, it will need some restructuring, and also it will need:
PHP unserialize on the values too

need to look at this and update the 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.

5 years 2 months ago #65075 by fopo-web
Do you have new informations?

I hope you can help me.

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

5 years 2 months ago #65076 by ggppdk
aahh, i forgot / missed looking into this

and do want to update FAQ for existing items
will check this tomorrow, don't hesitate to post reminder on Synday if you get no response


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

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.
Save
Cookies user prefences
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