Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I've enabled 'Address Populate' checkbox, and the user already has customer profile .
but when new checkout happen, there is no populate data on the Billing information Pane, (user have to Input the address information again)
Is there something I'm missing ?
Comment | File | Size | Author |
---|---|---|---|
#17 | user-account.png | 13.53 KB | rob3000 |
#12 | 1443460.12-commerce_extras-address-prepopulate.patch | 3.39 KB | mrfelton |
Comments
Comment #1
iMiksuIn address populate we don't use customer profiles. The address gets cloned from user's postal address fields, not customer profiles.
Please follow the next steps to get that working:
Does this help your issue?
Comment #2
iMiksuComment #3
iMiksuComment #4
rei CreditAttribution: rei commentedok, the populate works, but still the New customer profile being created again after new order happened. and user still have to fill in name on the billing pane on checkout page. so what does the purpose of the populate feature if user have to fill in name again and customer profile has to be created again automatically?
Comment #5
iMiksuDo you mean the customer profile gets created on each completed checkout process? That's how it should work.
Comment #6
rei CreditAttribution: rei commentedhmm, If I checkout 20 times with the same name and the same address, then there will be created 20 customer profile with the same identical data owned by the same user. Is this efficient ? . I think the purpose of Populate feature is to not creating the same data over and over again IF there is already available data. the creation of new customer profile should be done 1 time only for the unique address and name.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm testing the population with the alpha1 and it worked for me after I added an addressfield with the field name "address".
I can understand that saving an new customer profile with every new order is not the best way, but it works and future version of commerce will deal with that as well. So far I don't have seen a commerce shop where a client made so many orders that it became a real problem.
Comment #8
iMiksuThe original goal of address populate, is just to populate the fields for you according to the information you have in your account.
If we want to change the module to to handle customer profiles, it's totally different topic. Right? That kind of functionality sounds like Commerce Addressbook, so I probably would use that instead.
As @mikewink said, the problem isn't major if we have multiple customer profiles having same information.
Comment #9
118218 CreditAttribution: 118218 commentedHi,
For me it really does not work ..
I checked the configuration many times and everything is ok
Apparently it is this part of the code that causes problems:
The variable $value contains my fields content as expected (Country, Postal Code, City, Address 1, Address 2 configured in user account). But this condition isn't satisfied:
if (isset($form['commerce_customer_address'][$langcode][0]['#address'][$key])
So the form fields in "Billing Information" are not fulfilled. You know what's the problem?
Comment #10
118218 CreditAttribution: 118218 commentedComment #11
zach.bimson CreditAttribution: zach.bimson commentedThe problem im experiencing is related to this. Auto population is working as it should its the auto FIELDS based on country that aren't working.
For example:
All standard billing fields are populated but there is no post code box is shown.
If I then change the country from United kingdom to something else and back again the fields update and all information is displayed correctly.
Thanks,
Zach
Comment #12
mrfelton CreditAttribution: mrfelton commentedYes, the issue is as stated in #11. You can't just set the default values, you actually need to regenerate the widget so that it starts off with the correct set of fields for the default country.
Comment #13
mrfelton CreditAttribution: mrfelton commentedComment #14
iMiksuHas anyone tested the patch?
Is it possible to provide clear steps how to reproduce this? Is it AJAX related? Or having different set of address subfields in user than in the form?
Comment #15
j0rd CreditAttribution: j0rd commentedPatch #12 completely pulls in a wrong field. The field it's supposed to pull in my address is in Canada, and this patch pulls in an address from Alaska in the USA.
There's definitely a bug in this code I would believe.
Here's the issue I'm personally having with this module:
Enable Canada in your address field. Set your users location to Canada -> British Columbia -> Vancouver. Make sure your default country in Address field is United State (it is by default).
Then head to checkout and you'll notice "Country" and "City" are pre-filled correctly, but "State / Province" is not.
Comment #16
pramodganore CreditAttribution: pramodganore commenteddiff --git a/sites/all/modules/commerce_extra/modules/address_populate/commerce_extra_address_populate.module b/sites/all/modules/commerce_extra/modules/address_populate/commerce_extra_address_populate.module
index 98af41e..5d99687 100644
--- a/sites/all/modules/commerce_extra/modules/address_populate/commerce_extra_address_populate.module
+++ b/sites/all/modules/commerce_extra/modules/address_populate/commerce_extra_address_populate.module
@@ -72,6 +72,11 @@ function commerce_extra_address_populate_field_attach_form($entity_type, $entity
$langcode = is_null($langcode) ? LANGUAGE_NONE : $langcode;
foreach ($user_fields->{$user_address_field}[$langcode][0] as $key => $value) {
if (isset($form['commerce_customer_address'][$langcode][0]['#address'][$key])) {
+ if($key=='country' && $value != $form['commerce_customer_address'][$langcode][0]['#address'][$key]){
+ $address['country'] = $value;
+ $administrative_area = custom_misc_get_format_option($address);
+ $form['commerce_customer_address'][$langcode][0]['locality_block']['administrative_area'] = $administrative_area;
+ }
$form['commerce_customer_address'][$langcode][0]['#address'][$key] = $value;
}
}
Comment #17
rob3000 CreditAttribution: rob3000 commentedJust tried to reroll patch in comment #12 and it still doesn't work as @j0rd mentioned in comment #15
Replicated by doing the following:
Go to user account and enter default address as the following:
Country: Canada
City: Vancouver
Province: British Columbia
Postal Code: 12345
Add something to cart go to billing profile and State is not pre-filled.
However....
This does work when selecting Australia, the state field is pre-filled and works as expected.
I will investigate further to narrow down which countries it is effecting.
Comment #18
rob3000 CreditAttribution: rob3000 commentedComment #19
rob3000 CreditAttribution: rob3000 commentedI've managed to track it down to addressfield setting the default country before the commerce_extra_address_populate_field_attach_form function kicks in and sets the default country.
Ideally it would be great if addressfield module had a drupal_alter just before the default address is set so we can add our default. I'm just about to add the issue and patch to addressfield module but wondering if anyone else had any ideas??
Comment #20
Maico de JongI don't have the time to create a patch now(added to the todo list:) but i've managed to fix #19 by using the new hook_addressfield_default_values_alter()
Comment #21
thomas.wardin CreditAttribution: thomas.wardin commented@MDJ Webdiensten: Could you write a dummy-howto please?
Comment #22
gatiba CreditAttribution: gatiba commentedHi @thomas,
i resolved my commerce extra populate problems overriding hook_addressfield_default_values_alter() like @MDJ pointed out.
This is my personal working solution, i force the default country on commerce pane so all the fields (first of all the "province" one) are correctly set:
Tell me if you need more help!