Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I needed to allow my users the ability to change their webform submissions and have their cart contents update accordingly. As it has been mentioned by a couple of other people wanting this functionality, I've rolled a patch that does the following
- if a webform submission is edited, the item in the cart is also modified (including changing the price if product attributes are used)
- if a webform submission is deleted, the item in the cart is also deleted
- if a cart item is deleted, the associated webform submission is also deleted
Comment | File | Size | Author |
---|---|---|---|
#4 | uc_event_registration_v5.patch | 5.12 KB | willowmedia |
#2 | uc_event_registration_v4.patch | 4.83 KB | willowmedia |
uc_event_registration_v3.patch | 4.77 KB | willowmedia |
Comments
Comment #1
AndyF CreditAttribution: AndyF commentedThanks, sounds good. I'm currently working on a couple of other modules which will take priority, but I'll look at this when I can. Would you mind changing the white space to match the standards (looks like you're using tabs)?
Thanks
Comment #2
willowmedia CreditAttribution: willowmedia commentedHi, thanks for taking the time to have a look - you're right there were tabs in there (I thought my editor automatically inserted spaces!).
Anyway, please find a new version of the patch attached with the tabs changed to 2 spaces.
Comment #3
AndyF CreditAttribution: AndyF commentedThanks. I've taken another look through, mostly minor formatting issues but
hook_webform_submission_delete()
is important imho.TRUE/FALSE should be uppercase.
I don't think you need to use
isset()
here.Could you use
hook_webform_submission_delete()
instead of a form submission handler? It's more robust.Shouldn't be a space after the function name.
Comments should always wrap at 80 characters.
Strictly speaking, lines aren't supposed to end with white space (you can often tell the editor to remove this on save).
Thanks!
Comment #4
willowmedia CreditAttribution: willowmedia commentedHi Andy,
I remember now that I originally tried implementing hook_webform_submission_delete() but was getting recursive errors! This time I've put a recursive checkflag in place to stop the error.
Please find attached a new patch.
Thanks
Nick.