I searched the issue queue and didn't see any existing feature requests for this -- apologies in advance if this is duplicate...

If a user doesn't have any saved addresses in their profile, it'd be nice to alter the checkout form to add a "Save this address" checkbox, and perhaps an "address nickname" field that appears once you check the box. Then, once you submit the checkout form to review the order, the address is saved into their profile as if they had used the /user/N/addresses/add form.

#4 uc_addresses.patch10.08 KBtic2000
Members fund testing for the Drupal project. Drupal Association Learn more


freixas’s picture

I thought of this when I created the module but was unable to make it work. The idea was that each customer would decide whether or not to have a particular address saved.

However, the module is set up so that you (as admin) can save all addresses typed in at checkout, even ones for anonymous users. The module stores the addresses and waits for the account to be created. Once the account exists, it adds the addresses. Unfortunately, you don't get to specify a nickname during checkout. If an address already exists, it isn't added, of course.

Does this meet your needs?

MantasK’s picture

I don't understand. How can I save these addresses entered in checkout?
In my case only registered users can checkout and no address is saved after payment is completed.

I see that in page admin/store/orders/%/edit all addresses are accessible. Is there an easy way to save them automatically to user account? I just want that if there is no address entered in user account then module saves it as default and if there is modules saves it new one.
Thank you.

the problem is with payment modules which alter submition form. In my custom module I use: unset($form['submit']). The same way paypal module works, but I haven't tested it.
So hook_order with $op == 'submit' is never called.
To make it work I've changed uc_addresses_order function:
if ($op == 'submit' && $order->order_status == 'in_checkout') {
if (($op == 'load' || $op == 'submit')&& ($order->order_status == 'in_checkout' || $order->order_status == 'pending')) {

freixas’s picture

Status: Active » Postponed

While I think this is a great feature and have long wanted to add it, it probably will not be added in the immediate future, so I am marking it bug postponed.

tic2000’s picture

Status: Postponed » Needs review
10.08 KB

If anyone could test this patch would be great.

The patch allows a user to edit an existing address or save it as a new one.

freixas’s picture

Assigned: Unassigned » freixas

Hey—you da man! Thanks for taking on these old problems.

I know a lot more about forms now that I've written uc_product_keys than I knew when I worked on uc_addresses. I was just thinking about tackling this one, but uc_product_keys is more pressing. I'll check this out as soon as I get a moment.

freixas’s picture

I started doing some testing of this. I checked out the file versions you started from and applied the patches. Overall, the concept is nice and it doesn't take you away from the checkout page, which is good.

Originally, I envisioned this as being out of the main flow. The user already has enough fields to deal with and 99% of the time are not going to be worrying about saving or not saving their addresses. This is more of a theming issue, but we might want the option of allowing admins to decide if they want this or not.

Minor: "Don't Save" should be "Don't save".
Minor: "Edit" is confusing. Maybe "As edited".

Visit the checkout page. The "Saved addresses" field has the name of the filled in address. Proceed to Review Order and then select Back. The "Saved addresses" field says "Select one..." even though the address is still filled in.

Select "Save this address: As new". A field appears called Saved as". Select a different saved address. The address changes but the "Save this address: As new" remains. However, the "Save as:" field is gone.

Select any address. Select "Save this address: As new". Without changing the address at all, type a new name in the "Save as" field. The user has been allowed to make an error. (As I recall, you can't have two identical addresses in the system, but it's been a while since I looked at that code and I could be wrong.) Perhaps the user shouldn't be offered any options if the current address settings are exactly the same as the originally selected address.

I set up my system to fill in only the delivery address. I took the same steps as in the above paragraph and selected Review order. I received errors because the billing address was empty, but the "Save as:" field had disappeared in the delivery address.

As best I can recall, I went to the cart page and back to checkout. For the delivery address, I selected "As new" and entered a different name (no other changes). I selected a different address for billing and then hit Review order. I got the message "State/Provide field required". I wasn't able to reproduce this, so I may not have remembered the exact steps.

Start with the checkout page again, select "As new" and type in anything then hit return. The "Save as" field disappears.

I am out of time (the wife is calling me down for dinner :-), but there are some combinations that are confusing such as starting with two identical addresses (for billing and delivery) and choosing different options for each.

I think you may want to throw a few more test cases at this. It's headed in the right direction.

freixas’s picture

Assigned: freixas » MegaChriz