"Automatically fill in the billing address with the user's default billing address." (as well as delivery address) doesn't work at checkout page. My users are creating default address at registration and when they go to checkout page - address fields are blank, so they have to select their single address from the listbox...
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | autofill-fix-1735678-5.patch | 6.46 KB | megachriz |
Comments
Comment #1
vitiok78 commentedAbsolutely same problem...
Comment #2
megachrizI'm on holiday at the moment, so I can't test it out right now. Have you tested if the same problem occurs with a minimum amount of modules enabled? Thus with only the four "required" Ubercart modules and Ubercart Addresses (plus the modules they depend on) enabled? A conflict with an other module is one of the possible causes.
Comment #3
Anonymous (not verified) commentedJust tested it with minimal amount of modules (minimal D7.15 installation, four required UC modules, uc_addresses + modules they depend on) - issue with autofill still exist...
Comment #4
Anonymous (not verified) commented@MegaChriz any other thoughts of what might cause that issue?
Comment #5
megachrizI've been able to reproduce the problem and I'm working on a fix! I think some changes that were made in Ubercart lately caused this issue. I noticed that when you go to checkout, the order will be saved immediately to the database (with status 'in checkout'), while previously this didn't happen until you go to checkout review. The default addresses are filled in when you enter a "fresh" checkout, thus when little to none order information is known. The saved order state probably caused Ubercart Addresses to think the "fresh" checkout has already been passed, and thus it expects the addresses were filled in (or adjusted) by the customer already and that shouldn't be overwritten by the default addresses.
Here is a patch. The logic of filling in default addresses has been moved. Now this code is only executed when Ubercart tells other modules a new order is created instead of when the checkout page is entered.
Initially, this seems to be working, but I haven't tested yet if it has any side effects (new bugs).
Some things worth to be tested:
If you want to test the patch as noted above, then that would be great! Else, you'll have to wait till I have done all the tests noted above before I commit the patch. Ideally, all test cases should be included in automated tests, but for some test cases I just don't know yet how to write a test for that, particular because some javascript is involved in the process.
Comment #6
megachrizI've made a start with testing the patch myself, there's one thing that doesn't work correctly: when following the next steps the checkout form isn't autofilled:
1. Go to checkout. The address forms are prefilled.
2. Go to an other page, leave checkout without submitting the checkout form.
3. Go to checkout again. The address forms are empty now.
I haven't tested the other cases noted in #5.
I need to think about an other solution. Currently, I'm writing an automated test for checking if the address forms gets prefilled with the autofill option turned on and off.
Comment #7
megachrizI finally came to fix for this issue. The automated test for checkout has been expanded to test this case. I still hope that the fix doesn't have any unwanted side effects, though. Instead of explicitly filling in the checkout form, default addresses are now attached to the order when it's programmatically created. You still start with an empty address form when creating a new order in administration section, though.
See commit.
Further work
Since one of the automated tests has been expanded, this expansion should be back ported to the 6.x-2.x version. I'll leave this issue open, just for that and turn it to a task instead.
Comment #8
megachrizThe checkout test case got broken by the previous commit. I made a small change in this test. Hopefully it's no longer broken now.
See commit.
Comment #9
megachrizI've ported the test for autofilling addresses on checkout to the 6.x-2.x version.
See commit.
I set the original issue settings back, since the issue was originally going about 7.x-1.x version.