Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Inconsistency in Mage_Sales_Model_Quote_Item_Abstract::calcRowTotal ? 
 
DeBaas
Member
 
Total Posts:  51
Joined:  2010-07-20
 

Hi,

I found this peace of code in Magento’s core:

/**
     * Calculate item row total price
     *
     * @return Mage_Sales_Model_Quote_Item
     */
    public function calcRowTotal()
    
{
        $qty        
$this->getTotalQty();
        
// Round unit price before multiplying to prevent losing 1 cent on subtotal
        
$total      $this->getStore()->roundPrice($this->getCalculationPriceOriginal()) * $qty;
        
$baseTotal  $this->getBaseCalculationPriceOriginal() * $qty;

        
$this->setRowTotal($this->getStore()->roundPrice($total));
        
$this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
        return 
$this;
    
}

The total value is rounded before it gets multiplied with the quantity, but the basetotal does not, and afterwards they both are rounded anyway.
As a result, both values might become different although the basecurrency and used currency are the same.

Is there are logical reason for this, or is it an inconsistency ( bug ) ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
real34
Jr. Member
 
Total Posts:  3
Joined:  2011-06-20
 

Hi,

I found the same issue, and after looking into Magento CE1.8 code this has been “fixed”.
So just an update to answer your question: yes, it appears that it was a bug!

Here is the code in CE1.8

public function calcRowTotal()
    
{
        $qty        
$this->getTotalQty();
        
// Round unit price before multiplying to prevent losing 1 cent on subtotal
        
$total      $this->getStore()->roundPrice($this->getCalculationPriceOriginal()) * $qty;
        
$baseTotal  $this->getStore()->roundPrice($this->getBaseCalculationPriceOriginal()) * $qty;

        
$this->setRowTotal($this->getStore()->roundPrice($total));
        
$this->setBaseRowTotal($this->getStore()->roundPrice($baseTotal));
        return 
$this;
    
}
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top