I posted this question on the Entity Registration Issue Queue but I think its more suitable here since I haven't gotten a response in a long time. Below is the original question. I feel that others must of ran into this issue but I just looked through the entire Issue Queue and never saw anything about it which makes me feel that people just don't care about this or they have theirs set up differently then me.
Original Question:
I am using Entity Registration with Commerce Registration to build a site to signup for Courses and Events. In my case, it should be possible for someone to signup and purchase more than one course at a time. Though in order for that to happen you would add your two entities to the shopping cart, then you would be presented with 2 forms to fill out, same fields since they are both using the Course Registration Type, but still two forms since you have two entities in your cart. This doesn't seem like the biggest of problems until you have people purchases 5 classes at a time....
So, I am curious as to if the entities are referencing the same Registration Type, is it at all possible to show only 1 form and have that form work for all entities, updating their slot inventory too? My idea is if you add 5 Courses and 5 Events to your cart, you are present with only 1 Course Type Registration form and 1 Event Type Registration form.
If this is not possible, is there a way to include a "The information is the same in the other forms" checkbox that pre-populates the other registration form fieldsets with the same values the user put into the first? Similar to a copying address information to billing, but in a more wildcard fashion instead of listing out each individual field separately in the jquery.
Comment | File | Size | Author |
---|---|---|---|
#11 | commerce_registration_multistep_js.zip | 6.03 KB | ouissla |
Comments
Comment #1
TravisJohnston CreditAttribution: TravisJohnston commentedBUMP still in a huge need for this. I'm about to make a "Same for the other forms" button to copy the value to each, but I am really not looking forward to that solution. I seriously can not be the only person that experienced this.
Comment #2
cperisho CreditAttribution: cperisho commentedI am having almost the exact same issue come up. I have a situation where I may have a single person signing up several people for several different events- and we collect a lot of information on each person- like 10 or more fields.
One solution would be a "use the same on the rest of the forms" check box (worded better than that I hope). I think this could be achieved with some clever java script and maybe a special form element?
Another conundrum which you don't seem to have is returning customers. Say Bob signs his son Johnny up for soccer camp and his daughter Susy up for volleyball camp and next year he comes back to do it again- shouldn't the form say "should I use Johnny or Susy's information from last year?" and have it auto fill?
I am just learning about hooks and I'm not a Drupal or PHP master (or even a talented novice) but I'd be willing to work on this problem and/or pay someone to if you are interested in going in together on getting this to work.
A feature request might be in order- don't know if you can put bounties on such a thing. If someone gave me some clues on how I might fix it myself I'd be willing to hack away at it.
Comment #3
TravisJohnston CreditAttribution: TravisJohnston commentedHello cperisho,
I still haven't found a proper solution for this. I am also using field dependency on the registration forms and it breaks for all forms except for the first one... which also really sucks.
This week I am going to write up the jQuery to handle a "Same values on the rest of the forms" check box. If you google "jQuery same as billing address" you will see the code you need and its pretty self explanatory on what elements you need to change. Though the only thing that sucks is that the forms do not render with a decent target element to work with so I have to figure that out too.
As far as repeat users, mainly the browser will take care of that. It would be interesting though if you could program in a pattern collection that takes not of what an authenticated user does during registration, and offers suggestions based on previous actions. Thats way beyond this ticket though.
Comment #4
laughnanSubscribing
Comment #5
TravisJohnston CreditAttribution: TravisJohnston commentedSo below is the jQuery I am using to copy over the input on the first registration form. Note there are probably better ways of doing so but using things like clone() don't seem to do more good than harm.
Also I have only been able to get this to work for text inputs and select drop downs. Can't seem to figure out what I need to use to transfer over radio button toggles.
Comment #6
bjaxelsen CreditAttribution: bjaxelsen commentedI have the same problem, but slightly more complicated. We offer event registration for sport competitions. Here you might enter multiple persons (yourself and friends/colleagues) and you might register for more than one event at a time. So if you just add a checkbox ("Same Information on additional Registration") at the end of the first registration, the system will not know how to handle multiple persons.
I suggest a slightly different approach (similar to how eventbrite.com works): "Copy registrant information from" with the previously entered data as options.
I will be happy to code it, but is this the best appoach? Or cold we make it even more usable?
Comment #7
TravisJohnston CreditAttribution: TravisJohnston commentedIt would be most ideal if you had the ability to fill in 1 form per product. So if I had 10 people going to the same event, and I'm the assistant filling in the forms, it would be great if I could just fill in one form and perhaps have a section where you could just list off the other 9 people with only a Name and Email Address, with the option to provide further details for them if needed.
Comment #8
Breakerandi CreditAttribution: Breakerandi commentedPlease continue posting your workarounds, because i have the same problem and i need this function urgently but i have no idea about coding and workarounds... Thank you!
Comment #9
ouissla CreditAttribution: ouissla commentedI am working on a registration process where people can register for multiple events, for themselves and potentially for other people, which I think is quite a common scenario for an event website.
At the moment, register for 10 people, and you get 10 forms to fill, one under the other which is not really user friendly.
What I am trying to achieve is splitting the Registration checkout pane into a "multistep form". So the first page would be the first registration form, then you click next and you are presented with the registration form for the second registrant. At this point there could be a dropdown list for you to re-use details you used in previous forms.
If you know how to do that or if you think this would not work, please comment!
Thanks.
Comment #10
Breakerandi CreditAttribution: Breakerandi commentedSounds good!
Comment #11
ouissla CreditAttribution: ouissla commentedThe process I described earlier seems quite complicated to implement and as I can't spend too much time and my client expectations are actually not that high, I decided to use an other, easier option.
I have written a custom module that that alters registration pane form, wrap the different registration forms in divs and attach a javascript file. The javascript file creates a navigation bar based on the tickets in the cart, which allow to show/hide the different forms which make the use of this tab easier.
Here is what the pane looks like: http://tinypic.com/r/2lw6e02/8
- This module doesn't implement an option to re-use the data of a previously filled form. (Maybe a dropdown list with option based on the nav link could be implemented, so would say that you want to re-use the values of "ticket 2" for example, and then a javascript function does the rest)
- If you have a lot of registration then the nav goes on multiple lines. Still usable but not great.
Here is the code, it is not perfect but this can be a starting point if you like the idea. Note that I use the IFE module to handles inline error messages which is useful I think, and I updated the registration pane setup not to use a global fieldset.
[EDIT]I just attached a zip containing my files instead of pasting all the code here as this is not the best solution.[/EDIT]
Hope that helps
Comment #12
TravisJohnston CreditAttribution: TravisJohnston commentedSomething to think about though is the menu size. When a user adds 10 event registrations in their cart, they already have the checkout progression menu at the top (or at least I do), but then if there are now 10 more links up top... that will get ugly.
Separating them onto different pages is still not really a solution. IMO it actually makes the registration process for the user longer since they are filling in a form, pressing next, loading the next form, filling it in, etc. versus them all on the same page.
Some key functional points from what I am thinking is needed.
Comment #13
ouissla CreditAttribution: ouissla commentedYou're right. My custom module is very limited. I realized that after working a bit more on it. Your solution is interesting though.
Comment #14
cmonkedo CreditAttribution: cmonkedo commentedI am having a similar problem where I have 1 registrant signing up for multiple events and would like to carry forward the field data to subsequent registrations. I have very little experience with php coding for drupal, but have the patience to troubleshoot so @TravisJohnston in #5 you list the js, but how do you implement that into the module?
Thanks
Comment #15
TravisJohnston CreditAttribution: TravisJohnston commentedI didn't implement it into the module per-say, just added that to my themes JS file, replacing the field names and form id's where needed.
Comment #16
cmonkedo CreditAttribution: cmonkedo commentedThank you for your help, I have added the js file to my js folder and it is being added to my head profile section, I have modified the .field-name- entries to correspond to my fields but it is not creating a new class in the html and it is not adding the checkbox. Im not sure what you are referring to above when you state replacing the form id's. Is this in the js or elsewhere?
Comment #17
TravisJohnston CreditAttribution: TravisJohnston commentedShouldn't have said ID's, but just that you may need to change the classes if your setup is slightly different. The checkbox is currently setup, in my code, to show after the field .field-name-field-how-did-you-hear-about-thi, replace this with the last field you have in your first registration form. This could probably be handled better by adding a .last class or something beforehand so you don't have to be so specific with what field it falls after.
Comment #18
MohamedAli CreditAttribution: MohamedAli at Odd Hill commentedI been to a similar issue like the original question, and nothing worked as I actually wanted.. so I found that the best solution is just to disable the 'Registration Information' pane from checkout settings, and create my own pane which contain a normal form (with registration info fields) and in that form submit you can programmatically create multiple new registration entities referencing the order and each registration entity referencing each line item in the cart. and don't forget to check if the order already has registrations (in the case of user going back in the checkout process with back button) and update the registrations in this case not to create new ones.
I really like to hear other solutions for this, but this could help whoever came to this thread later..
Example how to create new checkout panes
Comment #19
TravisJohnston CreditAttribution: TravisJohnston commentedHi MohamedAli,
Do you have a working example of what you did? I don't understand how this differs from just having the standard registration pane and the multiple forms - seems like you are doing the same, just on a custom pane.
Comment #20
MohamedAli CreditAttribution: MohamedAli at Odd Hill commentedThe standard registration pane will have multiple registration forms if you add more than one product/event to the cart/order.. but in my custom pane I have just one form however the number of product is.. and in that form submit I check how many event/product attached to the order and I create a new registration entity for each product/event.
In the this example I assumed that you have two fields in the registration (first name and last name).. this code is not perfect, but it works..
Comment #21
TravisJohnston CreditAttribution: TravisJohnston commentedThanks MohamedAli,
This looks like it's a great step in a new direction - though will get messy with many form fields and if you have multiple registration form types (I have 6 for instance). I'm not sure how the registration form is structure in the db, but if it's an array, hopefully you could call that, and have it print the array for which ever form type is needed, which would then output all the fields, versus individually calling them.
Comment #22
MohamedAli CreditAttribution: MohamedAli at Odd Hill commented@TravisJohnston
You can also use drupal_get_form to do that, my code was just simple example, the final result of using custom pane can be achieved with several ways depends on your case.
Comment #23
TravisJohnston CreditAttribution: TravisJohnston commentedAwesome, Thanks MohamedAli,
I will play around with this when I get a chance to see if it works for me.
Comment #24
TravisJohnston CreditAttribution: TravisJohnston commentedI finally got this working!!! Took a long time to figure out how to do this in a way that saved the data properly so it works with core commerce_registration.
Here is the code you will need. It does the following:
Pros to this approach:
my_custom_registration.module
Comment #25
TravisJohnston CreditAttribution: TravisJohnston commentedComment #26
TravisJohnston CreditAttribution: TravisJohnston commentedComment #27
blacklabel_tom CreditAttribution: blacklabel_tom commentedHi,
I'm going to leave this one open to a patch if someone wanted to create one against dev. It also helps anyone else looking for a solution to find this issue.
Cheers
Tom
Comment #28
TravisJohnston CreditAttribution: TravisJohnston commentedOK thanks!
The only thing I see missing is to include our own check to look for an existing registration under the user or mail as the error message that appears by default from commerce_registration just says:
"The email address entered is already registered for this item." but you are not sure which item is it referring to so you don't know which one to remove from your cart.
Comment #29
droddis CreditAttribution: droddis commentedHi Travis,
This looks to be exactly what I'm looking for to solve a nagging issue with a non-profit who wants to have people register for multiple courses but the current process means that you need to enter data for each course, for each user.
I've copied the code and created the module. Can you help guide me with where I need to modify the .module code to ensure it's applied to my registration type? Currently the machine name is set to "course"
Thanks in advance, I know this should be simple but I always struggle to decipher the pure code!
Dave
Comment #30
TravisJohnston CreditAttribution: TravisJohnston commentedSure,
So "course" refers to the product type that I have registrations attached to. I specify that since I have other product types that are not tied to registrations and I don't want to modify the cart buttons if there are no registration products. (commerce-registration has a method to handle this but I didn't use it). So change this to the machine name of your product type that is used.
The other thing that I noted in the module was that I separate everything into separate line items first, so there is never a quantity over 1. This may be different for you so will want to modify that conditional statement to look at a $quantity > 1 instead and the number of line items, since you could have someone signing 2 people up for 2 different things.
Now what I have not tested though is how this works if you have multiple registration types. I found it easiest to use a single registration type, which I call Master Form. I put all my fields in this. Then I use Conditional Fields and based on the category of the product the registration is attached to, I change out which fields should be shown. In this module, I do not specify the registration type because of this.
So because of that I am not honestly sure if there will be an issue, but I suspect there would since the way this module works is it hides all the other forms except for the first form. So if each hidden form was a different registration type, then you would not be able to show and fill the proper fields.
For you, do you have multiple registration types? Or just one?
** Also to note, where you see "my_custom_registration_type", that is only the name of the session variable I am setting and is not specific to any actual registration type.
Comment #31
droddis CreditAttribution: droddis commentedHey Travis,
I ended up switching gears a bit, a common occurrence for me it seems when working in the left field of my Drupal builds.
I have a client who offers weekend long courses, with multiple sub sessions that form the actual product. We're trying to implement a registration process that allows individuals to register for 1 or more sub sessions. unfortunatly adding each sub session as a unique product means that the registration form wants to collect their information as many times as there are sub sessions booked. (Register for 3 courses, add in your information 3 times in the registration form). All Anon users FYI
What I've ended up doing is adding an option set with pricing attributes to the product, where they can choose 1 or more sub sessions (options), that add their cost to the total cost of the "product"
It sucks because I can't limit the number of total options sold (or number of registrations for each class/option) but it does allow me to create a system where I can complete registration information once, and have it applied to multiple courses.
I couldn't get the custom module to work but I'm also concerned I'm mis-interpreting the use case you built it for.
We will have multiple registration types for this client, so it may well be this is a dead end for me.
Comment #32
TravisJohnston CreditAttribution: TravisJohnston commentedYeah for me I only have one registration type, it would work if the types shared similar machine name fields though. But if there were additional required fields on the other types, then you would have trouble. Though there still may be a way to extend what I did to solve that.
For your product options, you could set up validation on the add to cart form to make sure they only choose a certain limit of options.