[SOLVED] update item with custom field

More
8 years 3 weeks ago - 8 years 3 weeks ago #64806 by ggppdk
Hello

aaah yes,
FlexicontentModelItem
inherits the method:

getItem() and not the load()

so you need to use getItem()

e.g.
Code:
$item_ID = 444; $itemmodel->getItem($item_ID, $check_view_access=false, $no_cache=true, $force_version=0);

The parent class and the method are these:
github.com/FLEXIcontent/flexicontent-cck...ntclassitem.php#L298


- i ll make tests and update the FAQ artilce tomorrow late evening (UTC+2),


-- 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...
Last edit: 8 years 3 weeks ago by ggppdk.

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

More
8 years 3 weeks ago #64807 by fopo-web
Sorry, it does not work: :(

My code:
Code:
$itemmodel = new FlexicontentModelItem(); $item = $itemmodel->getItem(368);

I get the error like in my first post:
Code:
<br /> <b>Fatal error</b>: Call to undefined method FlexicontentModelItem::_loadItemParams() in <b>/usr/www/users/fopozw/snowfun/snowfun/administrator/components/com_flexicontent/models/parentclassitem.php</b> on line <b>322</b> <br />

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

More
8 years 3 weeks ago #64808 by ggppdk
Hello

The parent class of the ITEM model,
- thinks that you are in Joomla frontend

so it tries to use:
_loadItemParams()

- which only exist in FlexicontentModelItem of frontend ,

Solution:

instead of:
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

do
require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');


thus you will load the frontend model


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

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

More
8 years 3 weeks ago #64809 by fopo-web
:(

The load of the item now works, but I can not save.
Code:
require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php'); $itemmodel = new FlexicontentModelItem(); $item = $itemmodel->getItem($area->id); $itemmodel->store($item);

Error:
Code:
<br /> <b>Fatal error</b>: Cannot use object of type stdClass as array in <b>/usr/www/users/fopozw/snowfun/snowfun/administrator/components/com_flexicontent/models/parentclassitem.php</b> on line <b>1688</b> <br />

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

More
8 years 3 weeks 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

Code:
$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...

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

More
8 years 3 weeks 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.397 seconds
Save
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