Your module promises to do exactly what I need (so exciting!) except that I can't seem to get it working. I'd appreciate it if you could offer any advice about where I might be going wrong to help me troubleshoot.

I have Webform, Ubercart, ECO, and Webform PHP all installed. In the additional processing section, I copied the sample processing code for Ubercart checkout (including the <?php tags) and changed the values after ["submitted_tree"] when they didn't match the field keys in my webform (although more often than not they did, so I would think if I had done that badly it would at least pass some of the values) but I left the customer[] variables alone. (I also changed the node ID for the product to be added to the cart, and this does work as expected.)

On the ECO settings page, I checked both "Activate customized billing pane functionality" and "customer pane", and on the Webform settings page I checked "allow cookies for tracking submission".

I feel like this must be something small that I've done - failed to check a setting somewhere or done something else minor, but I'm stumped and I'm not sure how to troubleshoot it. Any advice?

Comments

brightbold’s picture

I thought I had figured this out, when I inadvertently broke my working uc_cart_add_item() functions by moving some things into fieldsets. Once I figured out that I needed to add ["fieldset_key"] in between ["submitted_tree"] and ["field_key"] I thought that was going to fix the address-passing, but that didn't solve the problem.

Any other suggestions for things I can troubleshoot? Here's my code, in case it's something stupid that will be really obvious to someone else:

<?php setcookie("customer[first_name]", $form_state["values"]["submitted_tree"]["attendee_information"]["first_name"], time()+2592000, "/");
setcookie("customer[last_name]", $form_state["values"]["submitted_tree"]["attendee_information"]["last_name"], time()+2592000, "/");
setcookie("customer[company]", $form_state["values"]["submitted_tree"]["attendee_information"]["organization"], time()+2592000, "/");
setcookie("customer[street]", $form_state["values"]["submitted_tree"]["attendee_information"]["street_address"], time()+2592000, "/");
setcookie("customer[street2]", $form_state["values"]["submitted_tree"]["attendee_information"]["address_2"], time()+2592000, "/");
setcookie("customer[city]", $form_state["values"]["submitted_tree"]["attendee_information"]["city"], time()+2592000, "/");
setcookie("customer[country]", $form_state["values"]["submitted_tree"]["attendee_information"]["country"], time()+2592000, "/");
setcookie("customer[zipcode]", $form_state["values"]["submitted_tree"]["attendee_information"]["zip_code"], time()+2592000, "/");
setcookie("customer[email]", $form_state["values"]["submitted_tree"]["attendee_information"]["e_mail"], time()+2592000, "/");
setcookie("customer[phone]", $form_state["values"]["submitted_tree"]["attendee_information"]["phone"], time()+259200, "/");
if ($form_state["values"]["submitted_tree"]["attendee_information"]["state"]) {
   setcookie("customer[state]", $form_state["values"]["submitted_tree"]["attendee_information"]["state"], time()+2592000, "/");
}
else if ($form_state["values"]["submitted_tree"]["attendee_information"]["province"]) {
    setcookie("customer[state]", $form_state["values"]["submitted_tree"]["attendee_information"]["province"], time()+2592000, "/");
}
if ($form_state["values"]["submitted_tree"]["conference_fee"]["fee_category"] == "m1") {
    uc_cart_add_item(389, 1);
}
elseif ($form_state["values"]["submitted_tree"]["conference_fee"]["fee_category"] == "m4") {
    uc_cart_add_item(387, 1);
}
elseif ($form_state["values"]["submitted_tree"]["conference_fee"]["fee_category"] == "n4") {
    uc_cart_add_item(386, 1);
}
else {
    uc_cart_add_item(388, 1);
}
if ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "100K") {
    uc_cart_add_item(390, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "250K") {
    uc_cart_add_item(391, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "500K") {
    uc_cart_add_item(392, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "750K") {
    uc_cart_add_item(393, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "1M") {
    uc_cart_add_item(394, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "2M") {
    uc_cart_add_item(395, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "5M") {
    uc_cart_add_item(386, 1);
}
elseif ($form_state["values"]["submitted_tree"]["membership_costs"]["org_budget_size"] == "10M") {
    uc_cart_add_item(397, 1);
} ?>

The bottom two IF statements that add items to the cart are working; it's the top part that's not.

brightbold’s picture

I also tried: removing the country cookie (since I'm not using a country field), and putting an IF statement around address line 2, since it's not a required field. I was thinking that maybe having some cookies in there with no data was causing the whole cookie piece to fail.

Still no love. Any suggestions as to what else I could try? I am really stumped and desperate to get this working.

Thanks for this great module! The uc_cart_add_item piece has been a lifesaver!

brightbold’s picture

Status: Active » Fixed

Got this working, and I feel very dumb! My problem really was that I didn't have the fieldsets in the submitted tree. But in between the time I originally posted and the time I figured out about the fieldsets, I disabled the ECO customer pane and billing pane options (since there wasn't any billing address filled in, it was inconvenient for people to have to click Edit to enter the info.) Apparently I immediately forgot unchecking those settings as soon as I'd done it, and thus adding the fieldset had no effect. Only just now did I realize what I'd done. D'oh!

brightbold’s picture

Status: Fixed » Closed (fixed)
WebNewCastle’s picture

Hi,

I apologize I didn't see this earlier. I'm glad you were able to get this working for you. Some of the more advancement "stuff" for the webform module was a bit confusing for me too - less and less the more I used it. And if I remember correctly, the structure differs depending on where too - validation, post-submission - I could be wrong. I usually pull something up for a quick reference or stumble through a couple errors if I haven't used it for a while.

I love what can be done with Webform module, though. I've been starting to think about using it as a replacement for the Drupal registration form. Maybe. Maybe not. It's at the "idle thought" stage for me.

- Matt

brightbold’s picture

Status: Closed (fixed) » Active

Ugh. A year later I'm updating the webform (it's registration for an annual conference, which is why I haven't looked at it in a year) and the address is no longer being passed. The site is running the same version of ECO as last year (although I tested on my dev site with the latest ECO dev, and still no luck) and Webform 6.x-3.11 — I don't know what version of Webform I would have had a year ago, but from the release dates it looks like 6.x-3.2 is a possibility.

So I'm wondering if something changed in Webform during that time that would have affected the way the form_state syntax works for a multi-page form with fieldsets? Or if anyone has other ideas about what could have made this stop working?

brightbold’s picture

Update: It appears that it works fine if you don't proceed to the second page of the form (which only appears conditionally). If you go straight from page 1 (where the address fields are) to checkout, then the values are passed. But if you answer the questions in such a way that you proceed to page 2 of the form before checkout, then Ubercart doesn't get the values. (This makes me think that nothing actually changed; this part probably didn't work last year either.)

Is it possible to resolve this? Thanks for any help anyone can provide!

brightbold’s picture

Category: support » bug
brightbold’s picture

As a workaround (in case anyone else is experiencing this problem) I installed the Webform Conditional module so I could use same page conditionals, and thus eliminated the second page of the form. Once everything was on one page, the values pass correctly.

Also see related issue #943838: Billing pane showing cached data with multi-page webform (I guess that's the one I should have updated with my commend in #6, rather than reopening this, but I didn't originally realize it was a multi-page problem.)