I'm actually not sure whether it's a bug report or a support request.
On the checkout form, I have some fancy ajax tricks reloading some parts, and apparently the payment pane is refreshed too (I don't seem to do any action, so I suppose it's a standard DrupalCommerce behaviour). The problem is that $form_values contains only the related values for a part of the form, there is nothing related to the payment pane, and the following error happens:
Notice: Undefined index: commerce_payment dans commerce_payment_pane_checkout_form() (line 79 in /commerce/modules/payment/includes/commerce_payment.checkout_pane.inc).

Then, when I actually submit the payment part by submitting the whole form, the famous "EntityMetadataWrapperException" happens.

If I'm doing something wrong, can you help me fix it? Is there something peculiar to do when using ajax on some parts of the form.

#1 commerce_1643996_prevent_payment_notice.patch958 bytesSimon Georges
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Simon Georges’s picture

Status: Active » Needs review
958 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,567 pass(es). View

I'm proposing a patch that is working for me.

rszrama’s picture

Looks like a perfect patch, Simon! What's happening is the AJAX refresh triggers a rebuild of the entire form, not just the parts that you're specifically replacing via the AJAX refresh callback. Naturally, some form values have been filled out, so $form_state['values'] has data, but the commerce_payment array is empty until the user actually puts data in there. This looks like it was just a bad if check to begin with, and your patch is the right solution.

Welcome to the committers log. : )

Simon Georges’s picture

Wow, you're fast! Thanks for the credit!

Simon Georges’s picture

Status: Needs review » Fixed

Fixed, then?

rszrama’s picture

Ahh, heh, thanks. I just forgot to move it over. : P

Status: Fixed » Closed (fixed)

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