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.
Trace:
#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.
Best Answer
Use below code