cancel
Showing results for 
Search instead for 
Did you mean: 

Division by Zero Error

Division by Zero Error

I keep getting an error in var/log/system.log:

2017-01-10T18:44:58+00:00 ERR (3): Warning: Division by zero in /app/design/frontend/default/default/template/checkout/cart/sidebar/default.phtml on line 7

 

Here is the beginning of the code it is referencing (Line 7 falls on the "div class=item-inner" line:

<?php
    $_item = $this->getItem();
    $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
    $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
?>
 <li class="item<?php if(($i-1)%$_columnCount==0): ?>  last1<?php elseif($i%$_columnCount==0): ?> last1<?php endif; ?>">
   <div class="item-inner">
    <?php if ($this->hasProductUrl()): ?>

Any ideas what is wrong with the code?

 

2 REPLIES

Re: Division by Zero Error

Any ideas? I have narrowed it down to this snippit of code: 

<li class="item<?php if(($i-1)%$_columnCount==0): ?>  last1<?php elseif($i%$_columnCount==0): ?> last1<?php endif; ?>">

How should this be properly coded to clear up the division by zero error?

 

THANKS IN ADVANCE!!

Re: Division by Zero Error

Bump, anyone?