I'm calling:

$payment_name = Mage::getSingleton('checkout/session')->getQuote()->getPayment()->getMethodInstance()->getTitle();

in an extension for payment fees, so I can get the name of the payment method used for that order and display it. The problem is that the order details page (when a user is logged in) and the order details print (on the success page) both lead to an error:

The requested Payment Method is not available.

#0 /var/www/kd/dev.aaronia-shop.com/app/code/core/Mage/Payment/Model/Info.php(82): Mage::throwException('The requested P...')
#1 /var/www/kd/dev.aaronia-shop.com/app/code/core/Mage/Sales/Model/Quote/Payment.php(218): Mage_Payment_Model_Info->getMethodInstance()


But sales e-mails, admin-backend and everything else is working fine, just the order details giving me a headache. Commenting out/removing the $payment_name = ... line fixes it.

Is there a different way to call for the order payment method?

Edit: When I load the working code and log-in as a user, then go to an order details page, load the problematic code and refresh the page - it works. Then I can go back and check other order detail pages, all until I make a new order, then it breaks again and I get the error again when I try to see them.

1 Answer 1


Use below code

$order = Mage::getModel('sales/order');
$incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();

$payment = $order->getPayment()->getMethodInstance()->getTitle();
  • Fatal error: Call to a member function getMethodInstance() on boolean in /. . . . . ./Fee.php on line 46 In the line starting with $payment ...
    – Aardi
    Mar 9, 2016 at 10:35
  • Debug code do you get order increment id $incrementId there? Mar 9, 2016 at 10:40
  • Magento logs are empty and I unfortunately don't have access to PHP debugging (provider is really restrictive).
    – Aardi
    Mar 9, 2016 at 10:46
  • order instance is not created there need to check for it Mar 9, 2016 at 11:00
  • Okay, I tested something - when I reset the code to the working one and load one of the "Order Details" pages, then change the code to your solution (or my one) and reload it, it works - but only until I make a new order, then it's broken again (and orders don't work either with your code btw.).
    – Aardi
    Mar 9, 2016 at 11:04

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.