0

Does anyone know if it's possible to allow a user account to create an account after they have completed their order and then assign that order to their newly created account?

Thanks.

1

You'd have to make an extension upon member registration. If you're using the native EE registration the hook would be member_member_register:

public function member_member_register($data, $member_id)
{
  $this->EE->load->add_package_path(PATH_THIRD.'cartthrob/');
  $this->EE->load->library('cartthrob_loader');

  if ($order_id = $this->EE->cartthrob->cart->order('order_id'))
  {
    $this->EE->db->update('channel_titles', array('author_id' => $member_id), array('entry_id' => $order_id));
  }
}
1
  • Hey Rob, thanks for the reply. Just by happen thought of logging in here. Not sure why there's never any notifications on here. I have sent a few support requests over the past few weeks asking for some help with this but not sure if they got through. :/ Would this be relatively easy for you guys to write for us? We're also using Profile:Edit. – doubleplusgood Apr 5 '13 at 14:51
0

Yes it is.

On your {exp:cartthrob:checkout_form} just add create_user="yes".

Make sure you map the appropriate fields in the Cartthrob backend.

You can read more about members in Cartthrob on their docs. http://cartthrob.com/docs/backend/members/index.html

4
  • Thanks Jason. I think I'd need it to work inside the {exp:cartthrob:submitted_order_info} tag though on the "thank you for your order" page. :/ – doubleplusgood Mar 4 '13 at 13:18
  • Why? The checkout form will process the order, create the member and then take you - as normal - to the 'thank you' page. – Jason Varga Mar 4 '13 at 13:19
  • The process that we're after though is the user completes the checkout as a guest, but afterwards is asked "why not create an account" and then for the order detail to be added to the user's new account, rather than creating the account during the checkout form. – doubleplusgood Mar 4 '13 at 13:33
  • You could build that option into the checkout form. Put a <label><input type="checkbox" name="create_user" value="yes" /> Create a user account</label> in your checkout form and get rid of the create_user="yes" parameter. To do exactly what you are wanting, you may need to build something custom. – Jason Varga Mar 4 '13 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.