Search code examples
phpmagentoe-commercemagento-1.5

Magento possible bug in admin Order View when discount applied


Recently I've found one problem which I can't solve out. I've made shopping cart price rule, which reduces price by 20% when coupon applied. Discount is applied to price of products in cart INCLUDING tax. Shipping has no tax rule. Everything is fine, customer sees notice with correct price, even orders list shows correct price. There's only one place where I see it wrong - in Order View there's a field "Items Ordered" and here in Row Total it gives wrong price. It's ok with Order Totals.

Example:

  • Price inc. tax: 159.00
  • Discount (20%): 31.80
  • Price inc. tax after discount: 127.20
  • Tax (23%): 23.79
  • Total (with shipping): 147.20

  • Row total in Items Ordered: 121.26 (???)

I've checked all the tax settings and have no idea what might be wrong and how Magento calculates this. Any ideas?

Btw, my Magento version is 1.5.0.1


Solution

  • FYI, the place these values are calculated is in:

    app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml

    This file was fixed in 1.6.1, lines 242/243 were

    $_item->getBaseRowTotal() - $_item->getBaseDiscountAmount() + $_item->getBaseTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount(),
    $_item->getRowTotal() - $_item->getDiscountAmount() + $_item->getTaxAmount() + $_item->getWeeeTaxAppliedRowAmount()
    

    and are now

    $_item->getBaseRowTotal() + $_item->getBaseTaxAmount() + $_item->getBaseHiddenTaxAmount() + $_item->getBaseWeeeTaxAppliedRowAmount() - $_item->getBaseDiscountAmount(),
    $_item->getRowTotal() + $_item->getTaxAmount() + $_item->getHiddenTaxAmount() + $_item->getWeeeTaxAppliedRowAmount() - $_item->getDiscountAmount()