I just wanted to let you know what we're doing, and hopefully it can be useful to somebody. We've been able to setup paid events and memberships (not in production yet, or I'd send a site as an example). There are a couple of gotcha's left with events, but memberships seem to work smoothly.
We're using D6, so I don't know whether this is possible in D7 yet.
The following modules are needed to set it up all the way:
uc_civicrm_product (modified by Merlise here: http://drupal.org/node/1321002)
uc_webform (which we wrote and maintain)
(And Ubercart of course)
Here's how it works:
uc_webform allows you to attach a product to a webform, and it automatically kicks you over to checkout upon submitting the form. The form has a field so that you can tell whether somebody has actually completed checkout and finished paying for the product.
uc_civicrm_product allows you to specify that the product is actually a membership or event registration from CiviCRM. Again, the status of the purchase determines the membership or event registration status, but this time in CiviCRM.
I'm not going to try to describe all the scenarios where this is helpful, but they are numerous. Just install the two modules and start messing around, and you'll figure it out. If anybody has questions, I'd be happy to try to answer them.
FAIR WARNING.
uc_civicrm_product has problems. The official version doesn't appear to be supported anymore and doesn't work at all in the current version of CiviCRM. The version I linked to has been fixed to run in the current version, but she only fixed the Membership side, not the Event Registration side. We intend to try to get the Event Registration side of it fixed. Basically the only problem right now is that the order status isn't synced properly to the event registration in CiviCRM. You can see how everything works though. And Memberships have worked perfectly in our testing.
Comments
Comment #1
colemanw commentedInteresting. And where does the webform_civicrm module come into this? Or does it?
Comment #2
jtbayly commentedAhh... I can see I should have put a bit more detail in. I just felt like I was going to overwhelm with detail.
The point is that webform_civicrm is used to build the registration form, or the membership sign-up form, but you have an integrated way of getting the user to pay for it. The membership actually ends up in CiviCRM because of webform_civicrm, but it is *only* activated if the user completes checkout and pays. So you get all the benefits of using webform_civicrm, but also you can have paid memberships and events completely integrated into CiviCRM.
For us, the driving factor was that we want to be able to upsell products in our webstore during event registration or membership sign-up. So we really couldn't use the payment process in CiviCRM. We needed all payments to go through one system, which obviously needed to be Ubercart. That meant the registration process needed to be done outside CiviCRM, and simply written in using the API. So webform_civicrm was a huge amount of the work we were expecting to have to do already done for us! :)
I guess to generalize, if anybody wants to do event registrations through webform_civicrm for whatever reason (and there are many legitimate reasons), but they need to collect payment for the event, then they might think it's impossible. My point is that it *is* possible.
The project description says it's basically impossible: "Registering event participants via webform is a new feature in version 2.0, however working with payments or price sets is not available, so you cannot use webforms for paid events unless you collect payment by some other means."
I'm describing an integrated way to use webform_civicrm for event registration *and* collecting payments for those registrations (and selling other products as part of the registration as well, if you want).
Am I making better sense now?
-Joseph
Comment #3
jtbayly commenteda demo site can be found at http://cividemo.josephbayly.com/conference-registration
Comment #4
petednz commentedhi jt - very interested in this idea as a client is wanting to stick with selling Memberships via U/C even after we wire them in to CiviCRM.
We had tried out uc_civicrm_product but I found I wasn't getting full integration with civi eg contacts were being created not updated if they exists, but seemed to get around that by also using uc_civicrm. So odd that both you and merlise seem to be functioning without uc_civicrm - but that discussion belongs on another thread.
Your module may be the missing link since I wasn't able to include Custom Data fields with the above modules.
Let me know how/when we can help with testing etc.
Comment #5
jimurl commentedWe did something similar- using Webform-civicrm to register participants for an event, then using ubercart to allow them to pay for it. We didn't use uc_civicrm_product (since it appears that it won't work quite for event registrations yet). Note that this is for D6, civi 3.46 , not the D7 version that this issue is categorized as.
Here's how:
1. Build a civicrm-enabled webform with all the fields you need.
2. Create a product representing payment for your event. Give it an option/attribute "Participant ID" ( I also gave mine 2 other options: the participants name, and the event name).
3. After submitting the form, send the user to a custom url (in the 'webform settings' tab):
apply/process/%sid
4. using hook_menu within a custom module, map this url to a function:
5. Create a 'custommodule_apply_process' function like this. It adds an item to the cart:
( I used cart links, but I think you can also use UC's cart_add funtion.)
Populate the Participant ID field with CiviEvent's participant_id ( other attribute fields too, if you like).
6. Last step: switch the participant registration Status from "Payment Pending" to "Registered" using conditional actions. Our trigger was 'payment is entered' , the conditions were "Order balance is 0 or less" ; and for the action, we required a 'Custom PHP' type action:
This gets around webform_civi not handling payment for events.
Edit: this part in strikeout doesn't work, see Coleman's note below:
The only dicey part is in step 5, where it uses the contact_id and registration status (payment pending) to fetch the participant ID. If the user somehow several events that they have registered for but are in 'payment pending' status for both of them, this method could retrieve the wrong record.
This can be resolved by defining a webform field:civicrm_1_participant_1_participant_participant_id
( see your admin/help/webform_civicrm "ANATOMY OF A FORM KEY - for geeks only" to see how this works)
... and then, in step 5, use this participant ID instead of contact ID + registration status to retrieve the record.
I hope this can work for anyone needing it.
Comment #6
colemanw commentedNice writeup, thanks for sharing.
Re the last point: unfortunately, fields that aren't defined in the webform_civicrm_fields() function won't be processed, so you can't just add your own element and have everything work, even if you name it properly.
Perhaps in future we can work on that.
Comment #7
jimurl commentedYou're right, using "civicrm_1_participant_1_participant_participant_id" instead of contact_id component wasn't working. So we have to rely on there not being duplicate participant registrations for the same contact with the same participant_status.
Comment #8
colemanw commentedUnfortunately that field wouldn't be simple to add, because it can be multivalued (we allow the event form element to be checkboxes/multiselect).
I think a better solution would be to use the civicrm post hook. Everything you need should be available there (check if it's your webform submission with : if ($_GET['q'] == 'node/3292')
And this way you could handle more than one event.
Comment #9
petednz commentedhi joseph - not sure whether to comment here or http://drupal.org/project/uc_webform
I finally got around to trialling this
What we had was
uc_civicrm
uc_civicrm_product
outcome was, products (memberships) bought via ubercart did add/update memberships in civicrm
but now we need to collect other data when purchasing the membership and i thought of trying the uc_webform module
outcome: webform does indeed result in the product (which had been set up with civicrm membership) being added to the cart, but upon completion of payment nothing is being added to civicrm - unlike when we just start with a civicrm-ised product
any thoughts where to start pulling things apart?
do you still have this working since you said "Memberships have worked perfectly in our testing"
Comment #10
petednz commentedWhen i put the product in to my cart via both routes, i get the following
as a civicrm-ised Product
a:5:{s:10:"civimember";a:5:{s:18:"membership_type_id";s:1:"1";s:4:"pfid";s:1:"5";s:3:"nid";s:4:"4056";s:20:"membership_status_id";s:1:"1";s:6:"uccmid";s:1:"2";}s:10:"attributes";a:0:{}s:9:"shippable";s:1:"0";s:13:"donate_amount";N;s:6:"module";s:10:"uc_product";}
as a civicrm-ised webform product
a:5:{s:11:"webform_sid";s:1:"3";s:11:"webform_nid";s:4:"4060";s:13:"webform_ctype";s:7:"product";s:11:"webform_cid";s:1:"1";s:6:"module";s:10:"uc_product";}
Comment #11
jtbayly commentedSorry petednz, we've moved on to other things. However, I just went back into my summary notes of the project and its status, and I found that you are correct. Adding a civicrm-ised product via a webform causes the civicrm connection to not work properly. Our usage of memberships didn't have your requirement, but event registrations did. That was a bummer, and part of what caused us to move on.
However, if the product is not added by the webform, it works just fine. So... it might be possible to use the uc_webform_pane module or something similar in your circumstances. I don't know.
As for how to fix the actual problem, here are my notes from a few months ago:
"...Regardless the actual solution for this would probably require changes in uc_civicrm_product or possibly webform_civicrm or even uc_webform... It would be a bummer to track it down.
Testing indicates that it works to add memberships to the cart, as long as they aren't added via a webform. Using a webform to add them to the cart prevents the membership from ever being written into CiviCRM, *even if* that product is the *only* thing on the webform. No civicrm data needs to be collected on the webform to cause the problem, and no other products need to be on the form to cause the problem, either. However, the problem is more serious in that case (a WSOD when attempting to change the order status, as opposed to the data simply never showing up in CiviCRM.)"
Sorry I can't be more help.
-Joseph
Comment #12
petednz commentedThanks Joseph - i think we concluded much the same and went the track of doing some custom code to accomplish this via Attributes in the Product where we were able to pull/push data from/to civicrm successfully and get Membership created/renewed and get Address details updated.
Comment #13
zkrebs commentedIs there any update here for CiviCRM on D7, possibly with Drupal Commerce?
What about the Commerce Webform Module, would this help? https://drupal.org/project/commerce_webform
Comment #14
petednz commentedNot aware of D7 for this - my sense is this project is 'in limbo' - in terms of Commerce_webform - there would be a bunch of work required in a new module to set up all the API stuff afaik
Comment #15
zkrebs commentedThanks for the answer.
Has anyone created a stand alone webform that sends data to CiviCRM-events with price sets, then?
I have some complex needs for a webform design, where CiviCRM kinda lacks finesse. Was hoping I could leverage webform, but then the payment end of it is messed up.
Comment #16
sonicthoughts commentedAny work on payments would be welcome. Kind of the missing link with webform and events. Commerce definitely has a lot more momentum than Ubercart these days. Another approach might be to build off the entity work that is going on: http://civicrm.org/blogs/eileen/civicrm-entities-drupal-entities
Comment #17
colemanw commentedI think we can close this issue in favor of http://civicrm.org/make-it-happen#Drupal%20Webform%20Payment%20Integration