1

I have problem with the subtotal from the image below: enter image description here

I have 28.45 , which is calculated in this function from : Mage_Adminhtml_Block_Sales_Order_Create_Items_Grid

    public function getSubtotalWithDiscount()
    {
        $address = $this->getQuoteAddress();
        if ($this->displayTotalsIncludeTax()) {
            $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount()
                    + $address->getHiddenTaxAmount() + $this->getDiscountAmount();
            return $subtotalInclTax;
        } else {
            return $address->getSubtotal() + $this->getDiscountAmount();
        }
    }

and 28.56 , which is calculated in the same class , in this function:

public function getSubtotal()
{
    $address = $this->getQuoteAddress();
    if ($this->displayTotalsIncludeTax()) {
        if ($address->getSubtotalInclTax()) {
            return $address->getSubtotalInclTax();
        }
        return $address->getSubtotal()+$address->getTaxAmount();
    } else {
        return $address->getSubtotal();
    }
    return false;
}

Normally I should have the same values. In my case the $address->getHiddenTaxAmount() and $this->getDiscountAmount() are 0 . So i only have $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() for my first total (28.45) and in the second function I have this IF condition:

 if ($address->getSubtotalInclTax()) {
     return $address->getSubtotalInclTax();
 }

My question is why I'm getting the return value from that IF condition ? If it doesn't go inside it , it would return return $address->getSubtotal()+$address->getTaxAmount(); and everything would be perfect :)

Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.