Give the ability to match up fields in the checkout of ubercart to the profile.

Example:
Create address fields in the profile and link to the uc address fields.

Comments

arski’s picture

yes yes! This would be brilliant! Say the user has to fill in his address within uc - if those fields could be saved to and later populated from the user profile it would make so many things so much better!

Thanks a lot!

Martin

indytechcook’s picture

EvanDonovan’s picture

Issue tags: +out of scope

So in other words, is this feature request to be able to populate profile fields based on the order fields?

My reasoning in #633162: Track the data input into the Profile pane for a specific order, rather than for the user profile generally suggests that this may also be out of scope, unless you want a new order to overwrite the address data from a previous order. Note that you would need some kind of field mapping UI on the backend, like in the Salesforce API module.

EvanDonovan’s picture

Title: Associate UC Fields to Profile Fields » Associate UC Fields (esp. address) to Profile Fields
Issue tags: -out of scope

Ok, after clarification with indytechcook on IRC, the use case for this is to automatically populate the user's profile address fields (if there are any) automatically based on their billing address.

This wouldn't be out of scope if it updated every time they changed billing address. But I still think having different "versions" per order would be out of scope for this module, since it would no longer be an integration with profile.module, but with something custom.

However, what would be necessary would be to ensure that the address fields did not show in the profile pane, or else to have the profile pane below the billing pane, and have it populate them based on a jQuery script.

technikh’s picture

Issue tags: +profile, +UC, +address

I really like this feature.
subscribing..

technikh’s picture

Issue tags: -profile, -UC, -address

I temporarily did this for my use case. but it will be great if I can have a UI to map the profile fields.

function my_module_form_uc_cart_checkout_form_alter(&$form, &$form_state) {
  global $user;
  profile_load_profile($user);
$form['panes']['delivery']['delivery_first_name']['#default_value'] = $user->profile_first_name;
}
vantuykom’s picture

Priority: Normal » Major

I really would love this feature too
subscribing...

rolfmeijer’s picture

subscribing

EvanDonovan’s picture

Priority: Major » Normal

Oh, this would be a pretty nice feature. I won't have time to do it though.

I don't think it's major priority though just because it would be nice to have.

achton’s picture

To do this the other way around (saving order data to profile fields), I have utilized hook_uc_checkout_complete() to do something like this:

function taenk_uc_helper_uc_checkout_complete ($order, $account) {
  // check if data is already present in fields so we dont overwrite existing user data
  if (empty($account->firstname) && empty($account->lastname)) {
    // update name
    $account_edit = array('firstname' => $order->billing_first_name,
                          'lastname'  => $order->billing_last_name);
    $ret = user_save($account, $account_edit, 'User Profile');
    // .. check whether the save went well and act accordingly
  }

This could be extended to support more profile data and other profile categories.

WARNING: the third argument to user_save() is a little .. finicky. It COULD wipe other profile fields in that category if you are not careful. More info