At the end of the successful Checkout and payment process, on the Checkout complete screen, I get this:

Notice: Undefined index: method_id in commerce_payment_tokens() (line 251 of /home/learnabo/public_html/sites/all/modules/commerce/modules/payment/commerce_payment.tokens.inc).

Doesn't seem to have affected the order.

Comments

rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

Hmm, I don't see how this is possible for an order on checkout completion. If that data value is set, it should be for a valid payment method instance ID. Can you share any additional information about your payment configuration and the steps leading up to the notice? I can fix it in the event the token is used with orders whose selected payment methods no longer exist, but I'd like to see if we can actually figure out why it's failing in your case.

rszrama’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing for lack of further information. Feel free to reopen if you have steps to reproduce the issue.

Ravenight’s picture

Status: Closed (cannot reproduce) » Active

I am working on a major overhaul of an existing Commerce site and the payment methods are changing.
I am seeing this error on the order details page: user/%/orders/% for existing orders that use a no-longer valid (or active) payment method only if I use tokens in the display.
I can work around it by re-creating the page in panels / views and not calling tokens, but fixing this root issue seems like a better solution.

To re-create: use kickstart v2, create a few orders using any payment method. Remove the payment method module used from the site. Use page manager to take over the order detail page. Put a token on the order detail page in a custom content panel. It doesn't even have to be payment related - the order ID will cause the error to show.

I know you shouldn't remove a payment method module once it has been used, but it is a requirement on the project I am working on.

rszrama’s picture

Status: Active » Fixed

Ok, that was the info I needed. I've added an if statement where we define the tokens and supplied the "Unknown" token in case the payment method cannot be loaded.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/68652b6

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.