@john.oltman thanks, this works like a charm.
Thank you very, very much. This is much appreciated!
@john.oltman Ah, yes indeed, now I get it:
public function onUpdate ()
In my case I only have one state (complete) as there is no validation needed, it's for a private car-sharing platform.
I'd be very thankful if you could post an updated code, thank you :)
@john.oltman thanks for your answer. Yes, the registration is complete (that's my default status) and I tried multiple times with newly created registrations on newly created events.
I don't even think the code is fired as the logger doesn't display anything.
Hey John, sorry I haven't been able to test your code before today, some other unexpected projects were push in my workflow.
I've had the chance to test the code you posted and I can't get it to work. I might have done something wrong.
I created a custom module with the code above, enabled it on my Drupal instance and tried registering to an event. The user gets the confirmation email, but the owner of the event doesn't get the notification email. The dblog doesn't display anything related to that new module neither except for the installation notice.
I had the same error as the OP on my acceptance environment. I applied patch #4 which fixed that specific error, but there's another one now showing in the watchdog and causing a WSOD:
Error : Call to a member function getPluginId() on null dans Drupal\group\GroupMembership->__construct() (/var/www/projects/xxx/web/modules/contrib/group/src/GroupMembership.php ligne 37)
This error doesn't show on my local dev environment. Once the website is migrated to the acceptance environment, the error seems to hit only admin-level users except user ID1. Could it be related to permissions?
Thanks for your answer @john.oltman !
Yes indeed, we could have a custom module worked out in order to add that feature.
If you have any tips, code, advice, please feel free to let me know :)
I do have the same issue when updating from 11.10.0-beta2 to 11.10.0-rc2.
Site is locked on a WOSD.
So, I tested this patch and it actually doesn't solve the whole issue.
As far as I tested, the order confirmation email is correctly sent to the order contact email, but I still get the WOSD and the following error in the Watchdog:
InvalidArgumentException: Invalid step ID "" passed to redirectToStep(). in Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->redirectToStep() (line 214 of /var/www/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php).
I'll try that out, thanks John!
Hey John, I'm pinging on this as I've finally got some time to continue this project.
Sounds like a nice idea, but that means you can't have any custom fields for the registration on the global "Meeting" entity.
In my case, I've got an "Meeting" event.
Users can register to that event and should give infos like name and phone number
then they should choose between 2 different workshops in the morning (it's either one or the other)
choose between two different workshops in the afternoon (either one or another)
then they can also register for the dinner if they want to (and there are three different types of meals to choose from with different prices)
and they can reserve a parking spot for the whole event.
There should be a price for the global "meeting" event, but also prices to add up for the workshops, dinner meals and parking spot.
And, in an ideal world, I should be able to fix a maximum number of spaces for each workshops and for the whole meeting event.
I understand this is quite a very specific use case, though. ;)
Item #1
I created a separated issue which can be found here:
https://www.drupal.org/project/commerce_registration/issues/3365740
🐛
Allow anonymous checkout to use Order contact email
Fixed
Thanks!
Item #2
Actually, I'm wondering if the opposite wouldn't be better: instead of enhancing the Checkout Order summary (knowing that at this point, the allergies/name for each item haven't been set yet), I should rather be able to enhance the Registration information fieldset / block to display the type of ticket/product variation which relates to each registration. Seems more logical to me, as the user can then relate the allergies/name fields that needs to be filled in to the type of ticket: in my case, the user needs to know that a name/allergies field relates to the standard meal, or the the children meal, or to the veggie meal he added to his cart. I don't know if I'm clear enough here?
It was the beta4 version.
I did a composer update so Drupal Commerce could have been updated at the same time, indeed.
It's the first time I'm experiencing this error, but you're right, it's probably coming from the Commerce side instead.
Hey @john.oltman, following up on this:
I think I understand a bit better how this module works, thanks for your help.
Setting up product variations with the different type of meals indeed works nicely for my purpose. :)
However, I'm still trying to keep the checkout process as smooth and easy as possible and I can't work that out yet.
In my example above, I've got one "dinner" event with 3 meal types (veggie, standard, child - which are product variations).
I don't want customers to create an account on the website, so the checkout is always as Guest.
Let's say a user added 2 meals in his cart: one standard, one for a child.
Once the user is on the checkout page, he's presented with a "Contact information" block with an Email field.
Then there's the "Registration information" block which displays a fieldset for each space / meal, so in this case 2 fieldsets.
Inside those fieldsets, there's another Email field and the "allergies" field I added myself.
So that leaves me with 2 issues:
- First, I'd like the user to be presented with only one Email field. I don't even need to have a different Email field per registration as most of my users will register for them and their family (including children who do not have any email address yet).
However, removing the Email field from the registration form display for the Checkout view mode (admin/structure/registration-types/dinner/edit/form-display/checkout) induces an error (WSOD) at the end of the checkout process because these Email fields are used to send the confirmation email (which is something I need).
I don't know how to fix this. Ideally, I'd like the confirmation email to be sent only to the email address provided in the "Contact information" checkout block, but is this possible ?
- Second, in my case there's no way to relate the Registration information fieldsets to a specific Product variation. So as much as I need to be able to specify a name and the food allergies for each meal added to my cart, how can I know which of the fieldset relates to the child meal and which one relates to the standard meal?
I'm adding a screenshot in case my explanations aren't clear.
Thanks for your answer, @dcam.
Actually, not combining the amounts of ingredients isn't really a big deal.
I'll try to see what I can do by creating a View of recipe fields and display the ingredients field only.
I think I already tried that but wasn't really sure about how to select only 7 random recipes, and not 7 ingredients.
Thanks a lot for your answer, John.
And thanks for this module, I see there's been a lot of enhancements since I first used it a few months ago, that's awesome!
Thanks for your explanations, @john.oltman.
I'm selling tickets for various kinds of events, including dinners.
At the moment, I'd like to charge a certain amount for each meal sold and each meal is for 1 person (so per person, which is the same as per space, in my case).
Ideally, different meals (vegetarian, standard, child...) could have different prices.
At the moment I tried using Commerce Product variations, but if I try to register / buy 2 tickets (which means 2 persons) I can't choose a different type of meal (standard, vegetarian, child) per person.
I also tried adding a "List (text)" field to my Registration type for the same purpose which is allowing the registrant to choose a meal type for each "space" (= ticket = person), but as much as my "Allergies" text field is displaying for each registrant during checkout, the List (text) field for my meal type isn't showing up.
Hey @john.oltman, thanks for your answer.
It looks quite obvious to me, but maybe I missed something else.
In my case, I want to sell tickets for a dinner event, and I need to ask registrants to specify the following:
- Name
- E-mail address
- How many adult meals
- How many kids meals
- How many vegetarian meals
I was thinking about using the "spaces" field for that, but there may actually be another I didn't think of (I'm new to Commerce)?
AFAIK, you can find and translate those strings here: admin/config/regional/translate