The billing information pane also includes a required field for "Full name". I've extended this module to also allow selection of name user fields so this field can be prepopulated as well. Supports the username field as well as custom fields for first/last name.

Patch attached in next post.

Recommended making this a full project ASAP.

Good work by iMiksu :)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mossy2100’s picture

iMiksu’s picture

Project: Commerce Billing Information Populate » Commerce Extra
Version: » 7.x-1.x-dev
Component: Code » Address populate module

Actually this is already part of a full project. It's part of Commerce Extra, so I'll just move this issue there.

I'll check the patch details later. Can you rework the patch against Commerce Extra's Addess Populate?

mossy2100’s picture

Sure, I'll give it a crack! Thanks for the rapid response, much appreciated.

mossy2100’s picture

New patch attached. Sorry for so many changes, just trying to make it as good as possible and use programming best practices.

iMiksu’s picture

Title: Also prepopulate Full name » Prepopulating from other fields (not addressfield)
Status: Needs review » Needs work
FileSize
36.41 KB

I have tested the patch and thought thru your feature request.

My first thought was "Why just name field?". What makes name field so special that only that field should be populated by parallel fields? What if user has country or phone number? You could map your name into address field but not phone number?

Secondly, this feature pops up a bit out of scope, this module is more about Address Field and Commerce Customer. And I would really like to keep that simple as possible in sake of maintenance load ;)

Also, I see this feature request more related to address field than commerce stuff together with address field...

However, I was thinking still that how to achieve your need. I came up with an idea of using tokens. Maybe if we could write an separate module for defining default values for address field by defining tokens, your need would be achieved pretty nicely?

So, practically how it could work:

  1. Go to customer profile types (admin/commerce/customer-profiles/types)
  2. Manage fields of your customer type
  3. Edit your address field
  4. Change your default values and use tokens to declare the default values

Note: This screenshot just demonstrate how this could work.
Screenshot example

In summary, I would recommend to do this feature as a separate feature request to address field or to write an separate module.

mossy2100’s picture

The "Full name" field is displayed above the address on the checkout page.

mossy2100’s picture

FileSize
45.71 KB

Hi iMiksu

Sorry if I wasn't clear. When the customer checks out, a set of fields are displayed for their billing address. This includes field for "Full name" and the addressfield fields (see attached screenshot). Your module pre-populates the addressfield fields. My additions merely extend that functionality to also pre-populate the Full name field. Do you really think this should be a separate module? It would seem to me much simpler for users to have the functionality bundled. I agree that it's stretching the scope slightly to include the name, but not by much. A name is usually part of an address.

iMiksu’s picture

I just think the proposed solution is too specific (just about name fields) and this can be done in more generic way so we can cover more use cases.

May I ask, why you use different name fields instead addressfield's full name fields? If you just configure your addressfield in user entity to have full name field too?

mossy2100’s picture

"I just think the proposed solution is too specific (just about name fields) and this can be done in more generic way so we can cover more use cases."

I agree in principle but when I look at the checkout page I only see fields for the Full name and address field. Is there something I'm missing?

"May I ask, why you use different name fields instead addressfield's full name fields? If you just configure your addressfield in user entity to have full name field too?"

That's not a bad idea - I didn't know addressfield supported a full name field. I will have a look at that.

mossy2100’s picture

Updated patch with support for addressfield name fields. See if you like it!

mossy2100’s picture

Hey iMiksu

Looks like your module does what I want anyway - just needed to setup the Full name field in the addressfield the same in both the customer profile and the user fields, and then the Full name field is prepopulated on the checkout page by your code as well, as part of the addressfield :)

Sorry if I wasted your time.

Thanks,
Mossy

iMiksu’s picture

Status: Needs work » Closed (won't fix)

No problem, I'm happy you provided patches because someone still can apply this feature even it's not ported into the module.

Thank you for your contribution!

mossy2100’s picture

No worries, thanks for making a useful module!