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.
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 ?
Comment | File | Size | Author |
---|---|---|---|
#6 | issue-2822002-6.patch | 6.97 KB | mr.york |
#4 | commerce_address_templates.png | 11.42 KB | Grimreaper |
#3 | address_templates-fix_default_address-2822022-3.patch | 1.77 KB | Grimreaper |
address_templates.patch | 1.61 KB | vastr |
Comments
Comment #2
GrimreaperHello,
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:
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.
Comment #3
GrimreaperHello,
I have remade the patch as it is not applyable with git. And so I could not test it on simplytest.me
Comment #4
GrimreaperWithout 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
Comment #5
nagy.balint CreditAttribution: nagy.balint at Agence Inovae commentedThanks!
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"
Comment #6
mr.york CreditAttribution: mr.york at Agence Inovae commentedAttached the patch.
Comment #8
mr.york CreditAttribution: mr.york at Agence Inovae commentedCommited.