Author Topic: [SOLVED] WARNING: Division by zero error message  (Read 18204 times)

z-analysts

  • Jr. Member
  • **
  • Posts: 162
[SOLVED] WARNING: Division by zero error message
« on: July 02, 2012, 16:56:29 pm »
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

  • Beginner
  • *
  • Posts: 3
Re: WARNING: Division by zero error message
« Reply #1 on: July 02, 2012, 17:18:45 pm »
Hi everyone.

Same error, same place, same update...

andrew.glover

  • Beginner
  • *
  • Posts: 11
Re: WARNING: Division by zero error message
« Reply #2 on: July 02, 2012, 17:26:09 pm »
Hi all,
As with the others above. Same bug, same place, same upgrade.

sakabra

  • Beginner
  • *
  • Posts: 3
Re: WARNING: Division by zero error message
« Reply #3 on: July 02, 2012, 17:27:56 pm »
Me too!  :(

JerryQ

  • Beginner
  • *
  • Posts: 7
Re: WARNING: Division by zero error message
« Reply #4 on: July 02, 2012, 17:32:08 pm »
try this:
replace line 516 with this:
    if($category->products_per_row>0){
   $rest = $suglimit%$category->products_per_row;
    }else{
   $rest =1;}

andrew.glover

  • Beginner
  • *
  • Posts: 11
Re: WARNING: Division by zero error message
« Reply #5 on: July 02, 2012, 17:33:28 pm »
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.

z-analysts

  • Jr. Member
  • **
  • Posts: 162
Re: WARNING: Division by zero error message
« Reply #6 on: July 02, 2012, 17:41:32 pm »

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9969
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: [SOLVED] WARNING: Division by zero error message
« Reply #7 on: July 02, 2012, 21:55:00 pm »
The best solution is imho the one above and this
Code: [Select]
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;

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