I'd like to separate billing and shipping information into two profile2 profiles so they have their own tab when a user edits his profile. Would supporting profile2 be a possibility?

CommentFileSizeAuthor
#1 profile2-2013935-1.patch987 bytesdeggertsen
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

deggertsen’s picture

Status: Active » Needs review
FileSize
987 bytes

Here's a patch. This shouldn't interfere with those who are not using profile2 (haven't tested), but for those that are it allows them to select profile2 fields. I haven't thoroughly tested it, but it appears to be working for me! Please review.

cameron prince’s picture

Sorry for the belated reply. I'm just now getting back to this and was able to test the patch. I see the profile2 profiles as options now in the "Related customer profile reference field" select boxes. I also see the address fields in those profiles as options in the "Select account's address field" select boxes. Unfortunately, after adding my address to the profiles and visiting checkout, neither of the addresses are populated on the checkout page.

I added the address fields to the account settings and removed the profile2 profiles. Now when I visit checkout, the addresses are populated properly.

So the patch doesn't seem to break anything and allows you to select fields from profile2 profiles, but doesn't copy the data from them to the checkout fields.

deggertsen’s picture

Status: Needs review » Needs work

@cameronbprince, I believe I am having the same issue. Not sure when I'll get a chance to look into it more.

okaysuper’s picture

@cameronbprince I also had the same issue being unable to populate addresses on the checkout at the moment an address field from profile2 was added to the checkout pane.

I realized that the console was throwing an error on states.js which seems to have been fixed in the latest dev of jquery update.

After installing the dev version the problem was gone and address fields were properly populated on checkout even for profile2 addresses.

Hope this helps and maybe save time to @deggertsen as well

cameron prince’s picture

Issue summary: View changes

Wow, I can't believe it's been two years since I looked at this... Anyway, I tested the patch again and still have the same results.

After thinking about it, I realized it can't work, at least not properly, as it doesn't have a way of knowing which profile to get the address fields from.

The "Select account's address field" area of the checkout pane configuration really needs to be expanded to include radio buttons or a select box for choosing either the user entity or the profile2 entity as the source for the address field. Then the field name selector should be swapped or dynamically update based on the entity selection.

I need to handle prepopulating a phone number too, so I guess I'll go with a custom module for now.