I have an existing multipage webform and I added a Fee field and the payment information component to the last page and configured all the settings
When I use the form and click on next page it just redisplays the first page again. I am not getting any errors in the php log
Removing the payment information component removes the problem.
I am using webform 6.x-3.4 and pay 6.x-1.0-alpha5

Comments

quicksketch’s picture

Yeah I've noticed this also. I'm not sure how to fix it currently but I haven't looked too deeply into the problem.

pixel8r’s picture

Getting the same error/issue.
this is my error message:
warning: array_merge() [function.array-merge]: Argument #2 is not an array in ../modules/webform_pay/webform_pay.module on line 212

Subscribing.

update: could you take a look at line 184? It seems off and might be what is causing the error. But of course I may be wrong. thanks!

183 foreach ($parent_keys as $form_key) {
184 $element = &$element[$form_key];
185 }
muhleder’s picture

I think I have a fix for this, I'd like to test it a bit more before I upload a patch, but if anyone needs this now send me a message and I'll upload what I have so far.

Mark

muhleder’s picture

StatusFileSize
new3.56 KB

Ok, here's the patch so far.

Changes in webform_pay.module

check for $element existing simply to stop errors.
added webform_pay_merge_multistep() function to merge in values from previous steps. Code pretty much a straight copy and paste from webform.module. Wasn't possible to use an existing webform function to do this.

Changes in webform_pay.inc

Override the submit function, so we only call the parent function when we are on the last screen of the multistep form. This was working for me with the payment method on the last screen, not sure if it would work if the payment method was on an intermediate screen.

Added
$this->pay_method_form($form, $form_state);
I think this was from another patch, and was needed to work with the current version of webform.

Added
$form_state['webform_pay']['values'][] = $values;
into the validate function, I think this was to make sure all the values from previous screens were included when calculating the totals.

Sorry for being a bit vague, been a few days since I worked on this and have been deep in another project since then. The key is overriding the submit function though.

Thanks,

Mark

muhleder’s picture

Status: Active » Needs work

Changing status.

quicksketch’s picture

Excellent work, thanks muhleder! I haven't had time to review the webform/webform_pay queues recently and it may be a while before I can take a look at this problem. Thanks for the patch.

quicksketch’s picture

Status: Needs work » Fixed
StatusFileSize
new5.34 KB

Based on muhleder's work I've created this patch which mostly fixes the problem. It allows Webform Pay components to be used in multi-page forms, but only on the last page of these forms. Information like products, name, phone, etc, can all be on previous pages. The reason for this restriction currently is because Pay module needs to fire its own submission handlers, but only on the last page of the form. It may be possible to separate the Pay form from the submission handlers, but we'll save that for a follow-up issue.

quicksketch’s picture

Status: Fixed » Closed (fixed)

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