News:

Looking for documentation? Take a look on our wiki

Main Menu

Division by zero: $list_limit empty inside virtuemart config

Started by alepoudaki, December 24, 2012, 11:38:57 AM

Previous topic - Next topic

alepoudaki

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? 


Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

alepoudaki

I updated VirtueMart to 2.0.16 version and get the same error in files


  • administrator\components\com_virtuemart\helpers\vmmodel.php at line 274 (Site at VM Categories component) (
  • administrator\components\com_virtuemart\models\product.php on line 594 (administration -> Product List)

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

$limit is empty....

Ixelink

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 >:(

Milbo

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?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/