4

In the creditmemo all prices are shows as positive amounts, to make the difference between an invoice and a creditmemo more clear I would like to display the prices as negative values. Is there a way to show negative prices for creditmemos?

1 Answer 1

5

The good way:

rewrite the core class Mage_Directory_Model_Currency method formatTxt with this code:

public function formatTxt($price, $options=array())
    {
        $price = parent::formatTxt($price,$options);
        if ( Mage::app()->getRequest()->getControllerName() == "sales_order_creditmemo" ) {
            return "-".$price;
        }
        return $price;
    }

credit_memo_negative-display-prices

A dirtier way :

If you just want this to be a visual (display) change, you can simply edit the .phtml files and place a - in front of the price output.

You'd need to edit many places in the file, and multiple files (creditmemo, bundles, downloadables, configurables - off the top of my head) - see for example adminhtml/default/default/template/sales/order/creditmemo/view/items/renderer/default.phtml

EDIT: I have updated the routine, to actually call the core parent method first, this way you retain core functionality (if and when the core code changes with any upgrades)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.