VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: alepoudaki on December 24, 2012, 11:38:57 AM

Title: Division by zero: $list_limit empty inside virtuemart config
Post by: alepoudaki on December 24, 2012, 11:38:57 AM
Hello, I am using Joomla 2.5.8 and VirtueMart 2.0.14.

When I go to Product Categories page in Virtuemart Administration, I am getting the error below:
Warning: Division by zero in \administrator\components\com_virtuemart\helpers\vmmodel.php on line 275

Inside vmmodel.php , in setPaginationLimits() function I have the following code:

$limit = (int)$app->getUserStateFromRequest('com_virtuemart.'.$view.'.limit', 'limit');

if(empty($limit)){
$limit = VmConfig::get ('list_limit', 20);
}
$this->setState('limit', $limit);
$this->setState('com_virtuemart.'.$view.'.limit',$limit);
$this->_limit = $limit;

$limitStart = $app->getUserStateFromRequest('com_virtuemart.'.$view.'.limitstart', 'limitstart',  JRequest::getInt('limitstart',0), 'int');

//There is a strange error in the frontend giving back 9 instead of 10, or 24 instead of 25
//This functions assures that the steps of limitstart fit with the limit
$limitStart = ceil((float)$limitStart/(float)$limit) * $limit;    // LINE WITH THE ERROR


It seems like function VmConfig::get ('list_limit', 20) doesn't work, so my $limit variable is always empty... In my Joomla configuration.php file, I have set $list_limit = '10';
What should I define and where to get rid of this error? 

Title: Re: Division by zero: $list_limit empty inside virtuemart config
Post by: Milbo on December 24, 2012, 13:49:14 PM
you should update
Title: Re: Division by zero: $list_limit empty inside virtuemart config
Post by: alepoudaki on December 24, 2012, 14:16:51 PM
I updated VirtueMart to 2.0.16 version and get the same error in files


The code is the same:
$limitStart = ceil((float)$limitStart/(float)$limit) * $limit;

$limit is empty....
Title: Re: Division by zero: $list_limit empty inside virtuemart config
Post by: Ixelink on June 19, 2013, 22:23:35 PM
Hi Milo,

I have the latest Joomla (2.5.11) and the latest VM (2.0.20b), and we're 120 days waiting for this to be solved, because I still have this error!

Or am I missing something?

Maarten >:(
Title: Re: Division by zero: $list_limit empty inside virtuemart config
Post by: Milbo on June 22, 2013, 14:09:26 PM
The limit should never be empty and i have no clue why you have that. It seems that you configured it somewhere this way.

I just can say that the next version has an enhanced pagination. I added pagination sequence per category. There are also more tooltips to explain the settings in the cateogry. What happens, when you remove everywhere just the 0. Just write nothing/nada/null into it... just leave it empty. What happes then? still divide by 0?