• Resolved charis_r

    (@charis_r)


    Hello everyone:

    I have an issue with my site, it shows that there is a division by zero, must be the ratings. You can check my site: https://www.brightsimply.com and see it on the bottom (under the thumbnail).

    The weird thing is that I had the theme installed and this message didn’t appear, but then I run a Reset plugin and re-installed the theme and now it doesn’t go away.

    Here’s the code in the lines that have the issue:

    if(count($r) > 0)
    	{
    		$nr_ratings = $r[0]->cnt;
    		$sum 		= $r[0]->smm;
    		$sdd = ceil($sum/$nr_ratings);     ! ! ! THIS IS 1711
    
    		for($i=1;$i<=$sdd;$i++)
    		{
    			$concat .= ' <img src="'.get_bloginfo('template_url').'/images/star_full.png" width="15" />';
    		}
    
    		for($i=$sdd;$i<=5;$i++)
    		{
    			$concat .= ' <img src="'.get_bloginfo('template_url').'/images/star_empty.png" width="15" />';
    		}	
    
    	}
    	else
    	{
    		for($i=1;$i<=5;$i++)
    		{
    			$concat .= ' <img src="'.get_bloginfo('template_url').'/images/star_empty.png" width="15" />';
    		}	
    
    	}
    
    	return $concat." (".$nr_ratings.")";
    }
    
    function PricerrTheme_get_post_thumbs_fnc()

Viewing 15 replies - 1 through 15 (of 25 total)
  • Have you asked the developers of the theme?

    Thread Starter charis_r

    (@charis_r)

    Hmmm, nope.

    Is that their issue? I mean, is it a code issue?

    Because again I point out that I had installed this theme before the reset and this Warning didn’t exist.

    Do you have the same issue on the default theme with ALL plugins deactivated?

    Thread Starter charis_r

    (@charis_r)

    Well, de-activated all plugins, the problem is still there.

    If I install the default theme, like the twenty elevel or smth, then this page (and the ratings which are most probably the issue) won’t appear, will they?

    IF it’s part of your theme, no. But in that case, that’s would seem to be a theme issue. BTW, what do you mean you did a “reset”?

    Thread Starter charis_r

    (@charis_r)

    I installed the : WordPress Database Reset

    and ran it. It reseted everything in my wordpress site.

    I guess I’ll go ahead and re-install wordpress itsself and see if it works.

    Is there any tweak I can do to the code itsself to fix this?
    Or to the css?

    This is not a CSS issue but a code one. Try:

    – deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    – switching to the default theme to rule out any theme-specific problems.

    resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

    – re-uploading all files & folders – except the wp-content folder and wp-config.php & root .htaccess files – from a fresh download of WordPress. Make sure that you delete the old copies of files & folder before uploading the new ones.

    Thread Starter charis_r

    (@charis_r)

    Thanks esmi,

    well I deleted all the plugins, not just reset them.

    The problem is still there.

    I think I want just delete evrerythin from my domain and start over.

    I am not sure it that will work. What do you propose I do it? Just go through my hostgator panel, uninstall wordpress and then re-install it?

    Will this delete EVERYTHING, which is what I want?

    I was starting over either way, so it’s no such a big deal for me I guess.

    What about switching themes?

    Thread Starter charis_r

    (@charis_r)

    I changed my theme. The issue exists only on the theme I was. Because the specific ratings don’t even show on other themes, like the twenty eleven.

    I did almost everything, deleted all the themes I had, re-installed this one, deleted anything else I could,

    the issue is still there.

    My last resort is to delete the entire WordPress. If not, then it’s a code issue I don’t know what to say.

    I am so dissapointed. I think I might close my website, just let it go.

    I’ve had only problems up to now.

    Where did you download this theme from?

    Thread Starter charis_r

    (@charis_r)

    I don’t know, some site. Why? Maybe it’s a theme issue after all and I’m just wasting my time and energy

    The error message says it’s in your theme:

    Warning: Division by zero in /home3/charis/public_html/wp-content/themes/Pricerr/functions.php on line 1711

    The code on line 1711 in the Pricerr functions.php file:

    $sdd = ceil($sum/$nr_ratings);

    is the culprit. The the author does not check if $nr_ratings is 0 or not before doing the division and apparently $nr_ratings is 0 in your case and causing the error.

    The Pricerr theme appears to be a premium theme and you should contact the theme author.

    It would be a shame to ditch WordPress and all it has to offer because of one badly coded theme.

    Thread Starter charis_r

    (@charis_r)

    Oh, thanks scriptrunner. So it’s a code theme and I’ve wasted my time so far, installing and uninstalling things.

    Strange thing I didn’t have the issue before my reset.

    I’ll do. I guess they should be the ones fixing the issue and not me manually.

    If there’s an easy way for me to add this check to the functions.php, let me know

    thanks

Viewing 15 replies - 1 through 15 (of 25 total)
  • The topic ‘Having issue with a Warning: division by zero’ is closed to new replies.