VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: lysov on December 02, 2012, 19:35:20 PM

Title: 2.0.15a - 2.0.15c Warning: Division by zero in calculationh.php
Post by: lysov on December 02, 2012, 19:35:20 PM
Hi, I got next messages (quantity messages = count products) at the FE category view
Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php

The url looks like
index.php?option=com_virtuemart&view=category&virtuemart_category_id=297&Itemid=819&lang=ru&language=ru-RU&orderby=`p`.product_sku
prices set for all products

Joomla 258, VM 2015a
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: Milbo on December 02, 2012, 23:55:25 PM
the error shows usually also the line, please tell me.
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: lysov on December 03, 2012, 09:14:00 AM
Ah, sorry
Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1159 Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1159 Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1159
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: Milbo on December 03, 2012, 13:09:04 PM
a rule without value? Interesting, I think about to set a vmdebug
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: lysov on December 03, 2012, 20:27:59 PM
There are two rules, without taxes and not published  value added tax 18% (please see an attached image)

[attachment cleanup by admin]
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: Milbo on December 04, 2012, 12:45:29 PM
Exactly, the plublished rule has no value and has very likely no effect.
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: lysov on December 04, 2012, 13:04:48 PM
I fully share your opinion
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: Milbo on December 04, 2012, 13:17:02 PM
btw should be fixed in 15b
Title: Re: 2.0.15a: Warning: Division by zero in calculationh.php
Post by: lysov on December 04, 2012, 14:24:55 PM
Thnx Milbo, after update to 2015b:
Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1161 Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1161 Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1161
Title: Re: 2.0.15a - 2.0.15b Warning: Division by zero in calculationh.php
Post by: Milbo on December 06, 2012, 00:01:36 AM
Please post your line, I have if (strlen($mathop) == 2) { ?
Title: Re: 2.0.15a - 2.0.15b Warning: Division by zero in calculationh.php
Post by: lysov on December 06, 2012, 07:37:54 AM
With pleasure (for v.2015b)
                  if(!empty($value)){
                     if($sign == $plus){
                        $calculated =  abs($price /(1 -  (100.0 / $value)));
                     } else {
                        $calculated = abs($price /(1 +  (100.0 / $value))); // line 1161
Title: Re: 2.0.15a - 2.0.15c Warning: Division by zero in calculationh.php
Post by: lysov on December 12, 2012, 10:03:06 AM
After update to 215c:
Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1173
Warning: Division by zero in /var/www/html/tests/victum/administrator/components/com_virtuemart/helpers/calculationh.php on line 1173
                                                if(!empty($value)){
                                                        if($sign == $plus){
                                                                $calculated =  abs($price /(1 -  (100.0 / $value)));
                                                        } else {
                                                                $calculated = abs($price /(1 +  (100.0 / $value))); // 1173
                                                        }