News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] WARNING: Division by zero error message

Started by z-analysts, July 02, 2012, 16:56:29 PM

Previous topic - Next topic

z-analysts

Warning: Division by zero in /home/XXXXXXXX/public_html/XXXXXXXX/administrator/components/com_virtuemart/models/product.php on line 516

I just upgraded to 2.0.8a and got the above PHP warning message when I display products in category view.


strophe

Hi everyone.

Same error, same place, same update...

andrew.glover

Hi all,
As with the others above. Same bug, same place, same upgrade.


JerryQ

try this:
replace line 516 with this:
    if($category->products_per_row>0){
   $rest = $suglimit%$category->products_per_row;
    }else{
   $rest =1;}

andrew.glover

#5
Hi all,
Although I haven't explored all the repercussions to doing so. I solved the problem by simply commenting out line 516. It seams to work without affecting any other part of the shop.


Milbo

The best solution is imho the one above and this

if(empty($limit)){
if(!empty($category->limit_list_initial)){
$suglimit = $category->limit_list_initial;
} else {
if(empty($category->limit_list_step)){
$suglimit = VmConfig::get ('list_limit', 20);
} else {
$suglimit = $category->limit_list_step;
}
}
if(empty($category->products_per_row)){
$category->products_per_row = VmConfig::get ('products_per_row', 3);
}
$rest = $suglimit%$category->products_per_row;
$limit = $suglimit - $rest;

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