-
AuthorPosts
-
June 2, 2014 at 2:49 pm #198405
Hi,
I have a fresh JASocial site installed from the quickstart on a local server with all the sample data.
It works fine, just as in the Joomlart site demo, except for one thing: whenever I go to an item page, I see a message on top that says“Notice: Undefined property: stdClass::$numOfComments in C:xampphtdocsjasocialcomponentscom_k2viewsitemview.html.php on line 264”
For example, if a go to the menu K2 CATEGORIES->Item Page, a see the following
I have not altered anything on the installation or after it, so it is exactly the image of the quickstart as it comes with the download.
Any ideas?
Thanks,
Sergio.
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
June 2, 2014 at 3:28 pm #537432Here is something you can try . . . . .
Within file path —> /components/com_k2/helpers/utilities.php
there are multiple lines that look like this:
$item->image = $item->$image;
They should be this:
if($image != 'imagenone')
{
$item->image = $item->$image;
}Replacing those should remove the notices (and hopefully make things work better).
TomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
June 2, 2014 at 3:36 pm #537439If the above suggestion does not work, here are some additional resources that may be of assistance . . .
http://stackoverflow.com/questions/2471605/php-warning-undefined-property-stdclass-fix
http://getk2.org/community/English-K2-Community/189271-error-code-on-Item-View-page-after-k2-268-dev
June 2, 2014 at 3:57 pm #537446Hi TomC,
the $item->image = $item->$image; code replacement did not do the job, but one of the links that you recommended had the answer. Just to register if someone else had the same problem:
line 264 of …htdocsjasocialcomponentscom_k2viewsitemview.html.php has the following code:
$total = $item->numOfComments;
Changing it to:
if (empty($item->comments))
$total = 0;
else
$total = $item->numOfComments;will do the trick
June 2, 2014 at 4:00 pm #537447Tom,
do you think that I should maintain the /components/com_k2/helpers/utilities.php replacement that you suggested anyway or should I go back to the original code?
Thanks,
SergioTomC ModeratorTomC
- Join date:
- October 2014
- Posts:
- 14077
- Downloads:
- 58
- Uploads:
- 137
- Thanks:
- 948
- Thanked:
- 3155 times in 2495 posts
June 2, 2014 at 4:02 pm #537448<em>@scolcher 430302 wrote:</em><blockquote>Tom,
do you think that I should maintain the /components/com_k2/helpers/utilities.php replacement that you suggested anyway or should I go back to the original code?
Thanks,
Sergio</blockquote>Always keep a backup of the original file configuration – just in case.
You can then try the suggested code fix to see if it works for you. If it does not, you can revert back to the original and we can continue to work on the issue.
AuthorPostsViewing 6 posts - 1 through 6 (of 6 total)This topic contains 6 replies, has 2 voices, and was last updated by TomC 10 years, 5 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum
Notice: Undefined property: stdClass::$numOfComments in C:xampphtdocsjasocialcomp
Viewing 6 posts - 1 through 6 (of 6 total)