During checkout, even an address is selected for billing, fields (street, zipcode, ...) stay empty. I have to change to another address and come back to the first one to fill the fields.
I made a patch to correct it, can I have some code review please ?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kry_lalala created an issue. See original summary.

Grimreaper’s picture

Status: Active » Needs review

Hello,

Thanks for the patch. I will just do a code review on standards and process, I have not tested the patch and I didn't know this module before.

In your patch, do not keep commented code like:

//$addr_form = $addr_form_state = array();

If you have modified code because it was not good, just remove it, do not keep the old code commented.

About the issue, when you post a patch, change the issue status to "Needs review". Maybe I should change it to "Needs work" because of my code review but I would like the module maintainer to take a look at your patch.

When posting a patch. Create the issue first so you will have the issue nid to give a standard name to you patch. Example: address_templates-fix_something-2822002-2.patch

See: https://www.drupal.org/patch/submit#patch_naming for more info.

Thanks again for your contribution.

Grimreaper’s picture

Hello,

I have remade the patch as it is not applyable with git. And so I could not test it on simplytest.me

Grimreaper’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
11.42 KB

Without the patch, I can confirm the bug and I also had a warning (see attachment).

With the patch, there is no more warning and the feature is working properly. Thanks.

@kry_lalala: please see the documentation page on how to make a patch with git: https://www.drupal.org/node/707484

nagy.balint’s picture

Status: Reviewed & tested by the community » Needs work

Thanks!

However if I understand correctly by switching the condition to !addressfield_field_is_empty($form['commerce_customer_address'][$langcode][0]['#address'], NULL) means that if the addressfield is populated then it will override the values.
So If I select an address and change a value and then come back, it will revert to the original value, instead of keeping my changes.
Also when the form is empty on first submission, the right values wont be there, cause then I guess the addressfield is empty.

Maybe a better solution would be to change the "My addresses" field back to "none" when a value is changed by the user, then we can also remove the !addressfield_field_is_empty($form['commerce_customer_address'][$langcode][0]['#address'], NULL) condition, cause then it will always override the values unless they are changed and the field is set back to "none"

mr.york’s picture

Status: Needs work » Needs review
FileSize
6.97 KB

Attached the patch.

  • mr.york committed 13a22c6 on 7.x-1.x
    Issue #2822002 by Grimreaper, kry_lalala, mr.york: Default address
    
mr.york’s picture

Status: Needs review » Fixed

Commited.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.