When i use the example payment module i got everytime this Notice:
Notice: Undefined index: payment_details in commerce_payment_pane_checkout_form_submit() (line 190 of /usr/www/users/forward/autobikini/profiles/commerce_kickstart/modules/commerce/modules/payment/includes/commerce_payment.checkout_pane.inc).
in Line 190: if ($callback($payment_method, $pane_form['payment_details'], $pane_values['payment_method'], $order, $balance) === FALSE) {
i think the $pane_values['payment_details'] should be $pane_values['payment_method'] maybe a copy paste mistake? or am i wrong?
/**
* Payment pane: submit callback.
*/
function commerce_payment_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
$pane_id = $checkout_pane['pane_id'];
// Only submit if we actually had payment methods on the form.
if (!empty($form[$pane_id]) && !empty($form_state['values'][$pane_id])) {
$pane_form = $form[$pane_id];
$pane_values = $form_state['values'][$pane_id];
// Only process if there were payment methods available.
if ($pane_values['payment_methods']) {
$order->data['payment_method'] = $pane_values['payment_method'];
// If we can calculate a single order total for the order...
if ($balance = commerce_payment_order_balance($order)) {
// Delegate submit to the payment method callback.
$payment_method = commerce_payment_method_instance_load($pane_values['payment_method']);
if ($callback = commerce_payment_method_callback($payment_method, 'submit_form_submit')) {
// If payment fails, rebuild the checkout form without progressing.
if ($callback($payment_method, $pane_form['payment_details'], $pane_values['payment_method'], $order, $balance) === FALSE) {
$form_state['rebuild'] = TRUE;
}
}
}
}
}
}
Comments
Comment #1
rszrama commentedI think the code as is is correct, but I also can't reproduce the error. I do all my testing w/ the Example Payment Method and have never seen this problem. Perhaps you can gather some debug information by printing a dump of the offending variables in the line prior to the error?
Comment #2
ranx commentedI had the same error. It came when setting "Off-site payment redirect" to disabled in checkout settings. Moving it back under "payment" made the error go away.
I was using bank transfer as the only payment method.
Comment #3
rszrama commentedAhh, that might be the missing clue. Yes, you have to leave the Off-site payment redirect checkout pane on the Payment page. We need to devise some way to keep it locked in place there.
Comment #4
amateescu commentedThe proposal from #3 sounds good, any takers?
Comment #5
rszrama commentedAnd interestingly enough, we discovered that there actually is a #locked property on both the payment checkout page and pane... not entirely sure why we never ended up using it, but it's there. : P
Comment #6
michelle.ichinco commentedI'm getting the same notice as the original poster, but my "off-site payment redirect" is enabled in the checkout settings. Other ideas on why I am getting this notice?
Comment #7
4kant commentedMe too...
I have two payment methods: Cash on delivery and bank transfer. COD works fine but bank transfer brings out the notice.
I tried what was adviced here - no change. (OK-maybe I didn´t understand every detail ?)
Can someone help?
Comment #8
dianikol commentedSame story here
Comment #9
helior commentedTagging as a "nice to have" for 7.x-1.3
Comment #10
helior commentedA few things are going on on this patch:
- First off, we're documenting the use of the "locked" key in hook_commerce_checkout_pane_info(), and also setting a default of FALSE in the hook processor commerce_checkout_panes();
-However, in validating the panes "locked" key in the checkout form, we cannot access their original "page" key using commerce_checkout_panes () because it merges the results of hook_commerce_checkout_panes() with the user's configurations stored in the database.
So now there is an optional $skip_saved_data parameter on commerce_checkout_panes() that will allow you to bypass the configured settings (inherently it must also skip cache).
- Also, the main feature of this patch is that in the checkout form validation, it doesn't set any errors. Rather, the system is smart enough to know that the "locked" panes have only one option, and will automatically set the appropriate value while leaving a message to the user explaining what just happened.
- Proper checkout page titles are used in the select form item.
- Finally, the table drag has been improved to work more like the block admin page, where choosing a checkout pane from the select form item will move that row to the specified checkout page section.
Comment #11
helior commentedRyan, can you take a gander at this patch and maybe let me know if it's horribly wrong?
Comment #12
rszrama commentedWoohoo! Glad to finally get this committed. The only additional thing we found was that for some reason I had applied the ignored locked property to the on-site Payment checkout pane as well... dunno what I was thinking. : P
Comment #13
helior commentedThere was a typo in a last minute change we made with the t() variable placeholders.
Comment #14
rszrama commentedCommitted. Nice catch.