magentocredits

Magento credit memo get offline or online refund status


I'm trying to add to the PDF creditmemo rather the refund was given offline or online.

How do I get this information from the creditmemo?

I've tried to use the method getTotalOfflineRefunded() but it comes back null everytime.

Is there an arg for getData() I can use to get this value?


Solution

  • The values you are searching for, are saved on the order not on the creditmemo

    In the creditmemo model(Mage_Sales_Model_Order_Creditmemo) you will find something like this

    $this->getOrder()->setTotalOfflineRefunded(
        $this->getOrder()->getTotalOfflineRefunded()-$this->getGrandTota 
    );
    $this->getOrder()->setBaseTotalOfflineRefunded(
        $this->getOrder()->getBaseTotalOfflineRefunded()-$this->getBaseGrandTotal()   
    );
    

    So to get the total offline refunded you should try this:

     $order->load('{orderId}')->getBaseTotalOfflineRefunded();
    

    In case the difference between getBaseTotalOfflineRefunded() and getTotalOfflineRefunded() is not clear:
    Base always indicates the order amount in your "base" currency, while the other method gets the amount in the currency of the store where the order was placed in.