i'm using Magento 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 <?php echo $this->getValueProperties()?>>
            <?php if ($_total->getStrong()):?>
            <strong><?php echo $this->formatValue($_total) ?></strong>
            <?php else:?>
            <?php echo $this->formatValue($_total) ?>
            <?php endif?>
    <?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 ?

  • Where do you want to display this? .... order review, order place, admin view order ... etc Feb 13, 2015 at 18:38
  • I want to display this in order review :) Feb 13, 2015 at 18:41

2 Answers 2

//get quote
$quote = Mage::getSingleton('checkout/session')->getQuote();

//get payment from quote
  • 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. Feb 13, 2015 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? Feb 13, 2015 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. Feb 13, 2015 at 18:46
  • @brentwpeterson where is the link? :D Feb 13, 2015 at 18:47

Assuming that current_order is define (admin / sales history controller

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

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

    //Get card type

    //Get Payment Info

  • I want to display this in order review like mymagento.com/sales/order/view/order_id/181 Feb 13, 2015 at 18:42
  • The code above should work Feb 13, 2015 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. Feb 13, 2015 at 19:38
  • Can you update your question with your code Feb 13, 2015 at 22:39
  • Can we send the original amount which is appear in strong in reorders ? Sep 28, 2020 at 12:29

Your Answer

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

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