0

i'm using Magento 1.9.0.1 and i want to get the used order payment method in the totals.phtml

Here is what i have in: totals.phtml:

<?php foreach ($this->getTotals() as $_code => $_total): ?>
    <?php if ($_total->getBlockName()): ?>
        <?php echo $this->getChildHtml($_total->getBlockName(), false); ?>
    <?php else:?>
    <tr class="<?php echo $_code?>">
        <td <?php echo $this->getLabelProperties()?>>
            <?php if ($_total->getStrong()):?>
            <strong><?php echo $this->escapeHtml($_total->getLabel());?></strong>
            <?php else:?>
            <?php echo $this->escapeHtml($_total->getLabel());?>
            <?php endif?>
        </td>
        <td <?php echo $this->getValueProperties()?>>
            <?php if ($_total->getStrong()):?>
            <strong><?php echo $this->formatValue($_total) ?></strong>
            <?php else:?>
            <?php echo $this->formatValue($_total) ?>
            <?php endif?>
        </td>
    </tr>
    <?php endif?>
<?php endforeach?>

I want to get a simple echo with the the payment method like <?PHP echo $PaymentMethod; ?>

How can i get the payment method used for the order ?

2
  • Where do you want to display this? .... order review, order place, admin view order ... etc – Renon Stewart Feb 13 '15 at 18:38
  • I want to display this in order review :) – Venelin Vasilev Feb 13 '15 at 18:41
1
//get quote
$quote = Mage::getSingleton('checkout/session')->getQuote();

//get payment from quote
$quote->getPayment()
4
  • This will bring the current session payment method or it will take the payment method used for the finalized order, because i need it for the finalized order. – Venelin Vasilev Feb 13 '15 at 18:30
  • Hmz i'm kinda confused here, the order isn't finalized when the totals are displayed right? Could you elaborate a bit? – Toon Van Dooren Feb 13 '15 at 18:32
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – brentwpeterson Feb 13 '15 at 18:46
  • @brentwpeterson where is the link? :D – Toon Van Dooren Feb 13 '15 at 18:47
1

Assuming that current_order is define (admin / sales history controller

if($order = Mage::registry('current_order')){

    //Get Payment
    $payment = $order->getPayment()

    //Get card type
    $payment->getData('cc_type')

    //Get Payment Info
    $payment->getMethodInstance()->getCode();
    $payment->getMethodInstance()->getTitle();

}
5
  • I want to display this in order review like mymagento.com/sales/order/view/order_id/181 – Venelin Vasilev Feb 13 '15 at 18:42
  • The code above should work – Renon Stewart Feb 13 '15 at 19:09
  • No it's not: Fatal error: Call to a member function getPayment() on a non-object in /public_html/beta/app/design/frontend/base/default/template/sales/order/totals.phtml Please help me out resolve this problem. – Venelin Vasilev Feb 13 '15 at 19:38
  • Can you update your question with your code – Renon Stewart Feb 13 '15 at 22:39
  • Can we send the original amount which is appear in strong in reorders ? – Hamendra Sunthwal Sep 28 '20 at 12:29

Your Answer

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

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