- Posts: 19
COMMUNITY FORUM
K2 - White screen when saving item and php error
- D
-
Topic Author
- Offline
- New Member
I'm using this as a demo site to teach myself k2.
Overall everything works great, but whenever I attempt to edit an item as a front end user, my screen goes white when I save the item and I get this php error:
Fatal error: Call to a member function getSearchValue() on a non-object in /homepages/7/d123968617/htdocs/public_html/clients/administrator/components/com_k2/models/item.php on line 721
FYI, I can edit and save an item as a back-end admin without any trouble.
I am developing locally using WAMP server on a windows vista machine.
I thought the problem might be with my local server setup so I uploaded everything to a hosting account at 1and1.com. I get the exact same error on the hosting server.
I've searched the forums and run google searches, but nothing I've found solves my problem.
Any help would really be appreciated.
Please Log in or Create an account to join the conversation.
- D
-
Topic Author
- Offline
- New Member
- Posts: 19
Please Log in or Create an account to join the conversation.
- D
-
Topic Author
- Offline
- New Member
- Posts: 19
I can create and save new items without a problem.
Please Log in or Create an account to join the conversation.
- D
-
Topic Author
- Offline
- New Member
- Posts: 19
I commented out the foreach block of code that begins on line 719 in
administrator > components > com_k2 > models > item.php
That solved my problem. But I don't know what the repercussions are for commenting out that code. It solved my immediate problem, but may create more.
Here's the code block as it is now, with my change:
require_once (JPATH_COMPONENT_ADMINISTRATOR.DS.'lib'.DS.'JSON.php');
$json = new Services_JSON;
$row->extra_fields = $json->encode($objects);
$extraFieldModel = K2Model::getInstance('ExtraField', 'K2Model');
$row->extra_fields_search = '';
/* BEGIN MY EDIT HERE TO DISABLE THIS CODE
foreach ($objects as $object)
{
$row->extra_fields_search .= $extraFieldModel->getSearchValue($object->id, $object->value);
$row->extra_fields_search .= ' ';
}
*/ END MY EDIT HERE
//Tags
if ($use
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
Try setting javascript in the k2 options layout tab at the top on your localhost version to load local copy and see if that may be the problem.
Please Log in or Create an account to join the conversation.
- D
-
Topic Author
- Offline
- New Member
- Posts: 19
I am aware of the dangers of editing core files, but I need to put a band-aid on this so I could keep moving.
I tried your suggestion. In Parameters, I went to Layout & Views and change the jquery library handling from
"Load v1.8.x latest (remote copy)
To
"Load v1.8.2 (local copy)
I logged out a frontend user and logged back in.
No change. i still get the error.
I also tried changing "Backend jQuery & jWuery UI handling" to local, but that had no effect.
Any other ideas?
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
The item is saved even though it throws the error
Please Log in or Create an account to join the conversation.
- D
-
Topic Author
- Offline
- New Member
- Posts: 19
So are you saying that you just discovered this error or did you manipulate your set up in some way to duplicate the error?
Ultimately I'd like to get this resolved without the core hack that I did, but the system has to function, and appear to function properly, when I turn everything over to my client.
I guess the worst case scenario is to leave my core hack in place, make note of it, and hope the hack doesn't create other problems.
Do you think this is a bug? Should I report it as a bug?
Please Log in or Create an account to join the conversation.
- william white
-
- Offline
- Platinum Member
- Posts: 3722
Got the same error
Applied the hack commenting out the foreach loop complely
and the error went away, but in j30 site the save and close button also went away requiring you to click the x to close the screen.
I think its a bug
Please Log in or Create an account to join the conversation.
- Eduardo
-
- Offline
- Junior Member
- Posts: 23
Can you please also check if your tags and extra fields are working? If they appear on the article you save... only new articles, not old ones.
Thanks
Please Log in or Create an account to join the conversation.
- george
-
- Offline
- New Member
- May The Force be with you.
- Posts: 12
The same problem. I confirm it to. It happens only in K2 items with extra fields assigned to them.
I have the latest versions for everyhting ( Joomla 2.5.7, K2 latest)
Please Log in or Create an account to join the conversation.
- Darren Janeczek
-
- Offline
- New Member
- Posts: 4
I've encountered the same issue, and came up with a solution.
It appears that attempts to find the extrafield.php file fails.
I've added the 'administrator' model location to the include path.
to line 17 of Joomla/administrator/components/com_k2/models/item.php, add
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models', 'K2Model');
Below is a print out of the 'diff'.
$ git diff Joomla/administrator/components/com_k2/models/item.php
diff --git a/Joomla/administrator/components/com_k2/models/item.php b/Joomla/administrator/components/com_k2/models/item.php
index 068f283..64afb2c 100644
--- a/Joomla/administrator/components/com_k2/models/item.php
+++ b/Joomla/administrator/components/com_k2/models/item.php
@@ -14,6 +14,9 @@ jimport('joomla.application.component.model');
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
+JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models', 'K2Model');^M
+
+
class K2ModelItem extends K2Model
{
getk2.org/community/New-to-K2-Ask-here-first/163385-Error-after-K2-update#163924
Please Log in or Create an account to join the conversation.
- Mk
-
- Offline
- New Member
- Posts: 5
I tried this but no luck.
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models', 'K2Model');
Info: The item is saved but not its extra field values
Please Log in or Create an account to join the conversation.
- Tomasz Bieliński
-
- Offline
- Senior Member
- Posts: 42
regards Tomek
Please Log in or Create an account to join the conversation.
- Darren Janeczek
-
- Offline
- New Member
- Posts: 4
Only the one line needed to be added at line 17 of the specified file.
Sorry for any confusion.
Please Log in or Create an account to join the conversation.
- Eduardo
-
- Offline
- Junior Member
- Posts: 23
Can you explain clearly, what needs to be changed?
Thanks
Please Log in or Create an account to join the conversation.
- Darren Janeczek
-
- Offline
- New Member
- Posts: 4
In your Joomla folder, look for the following file:
/administrator/components/com_k2/models/item.php
Inject the following text into a new line 17:
JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'models', 'K2Model');
D.
Please Log in or Create an account to join the conversation.
- Rodrigo Emygdio
-
- Offline
- New Member
- Posts: 1
Thanks for your tip! I updated the code and the error is gone. But When I updated the item the information of extra fields type of link lost the information about link, staying just a letter A in text and just one letter of the url in field URL. This happens just when a user update in the item in front end
Please Log in or Create an account to join the conversation.
- Lefteris
-
- Offline
- Platinum Member
- Posts: 8743
Please Log in or Create an account to join the conversation.
- Mk
-
- Offline
- New Member
- Posts: 5
Fatal error: Call to undefined method K2ViewItemlist::buildAliasBasedExtraFields() in \components\com_k2\models\item.php on line 1466
from where can i download 2.5.7 version?
Please Log in or Create an account to join the conversation.