Problem/Motivation
I tried to use module commerce_checkout_redirect to allow anonymous users to login or register during checkout, but could never get it to work with registration. After trying to fix that module, I gave up and looked for a simpler solution.
I like commerce_login_step's simplicity, so decided to add user registration support to it.
Proposed resolution
The attached patch adds a third option "Register". If selected, a link is printed to the registration page, and the HREF contains a query parameter with the commerce order ID. Along with a form alter and new submit handler, upon successful registration, the user is redirected to the checkout page for that order.
Remaining tasks
Testing.
User interface changes
n/a
API changes
n/a
Comments
Comment #1
krisahil CreditAttribution: krisahil commentedComment #2
krisahil CreditAttribution: krisahil commentedAdded slightly modified patch, that includes a "forgot password" link.
Comment #3
krisahil CreditAttribution: krisahil commentedI re-rolled this patch to also include changes from https://www.drupal.org/node/2377321#comment-9594325. That issue helps a lot with UI, so I wanted to integrate those changes here.
Comment #4
Sam152 CreditAttribution: Sam152 commentedFew issues with the patch:
1. I would consider looking into commerce_checkout_redirect and seeing how it stores the cart ID as the user navigates between checkout and registration. It uses session storage and the implementation seems a lot neater than the hidden ID in the registration form we have implemented here.
2. Undefined index errors in 'commerce_login_step_form_commerce_checkout_form_alter' for $existing_form_prefix = $form['#prefix']
3. The suffix references the prefix $existing_form_suffix = $form['#prefix']
4. I think there is a security issue. I can't see anything preventing users from resuming the orders of others using the $_GET['commerce_login_step_oid'] param.
Comment #5
Anybody+1 for the idea and confirmation of #4
Comment #6
mglamanI think Commerce Checkout Complete Registration should be referenced for implementation, or this option marked "won't fix" in a push to use it.