0

I'm trying to modify the payment block on the order detail page in backend. Therefore I've created an observer which is listening to following event:

payment_info_block_prepare_specific_information

Now, when I'm trying to get the payment code with

$payment = $observer->getEvent()->getPayment();
$paymentmethod = $payment->getMethodInstance()->getCode();

I do get following error for credit card payments (Authorize.net) only:

PHP Fatal error:  Call to a member function getCode()

Orders placed by using PayPal Express Checkout work though. Do I miss something? I appreciate any help.

Magento ver. 1.14.2.4

1

There's a shorter and more direct way to the data you want. The method code is stored on the payment info instance (sales_flat_order_payment) as column method.

That means:

$payment = $observer->getEvent()->getPayment();
$paymentmethod = $payment->getMethod();

That should give you the payment method code (as a string) in $paymentmethod.

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.