Problem/Motivation
On the user registration page (user/register) Ubercart Addresses only provides a feature for asking for one address. Since version 6.x-2.x it has a concept of default shipping and default billing addresses. Because of that, it would be nice to have a feature that asks for two addresses at the user registration page:
- One for the default billing address;
- And one for the default shipping address.
There should also be an option for the customer to specify that both addresses are the same, so he/she doesn't need to enter the same address information twice.
Proposed resolution
There is no proposed resolution yet. The first step would be a description or a graphical representation of how this feature should work. Think about:
-
The user registration page
Should the sections where addresses are asked, just look and behave like the delivery/billing checkout panes? -
The Ubercart Addresses settings page
How should admins be able to choose if they want to ask customers for none, one or two addresses at the user registration page? Keep in mind that admins can disable the option to have default shipping and/or default billing addresses. How should the settings page react on that?
Remaining tasks
- Write a proposal of how this feature should work for both the user registration page and the Ubercart Addresses settings page.
User interface changes
Probably, but depends on the proposal.
API changes
Not sure yet.
Original report by ColinMctavish
Hi,
I don't know if I am overlooking something, but it seems to me that I can't have someone register with a billing and shipping address. I am only allowed one address. Can someone tell me if its possible to have someone sign up with the ability to have two addresses and also have a validator if the billing is the same as the shipping it would then autopopulate (and vice versa).
Thanks!
Comments
Comment #1
freixas CreditAttribution: freixas commentedActually, it's worse than that: there is no concept of billing vs. shipping address. In fact, there is no concept of either billing OR shipping addresses—there is just a default address.
A feature like this sounds useful but it is unlikely to get into the code anytime soon. For the time being, the answer to your question is: no.
Comment #2
MegaChriz CreditAttribution: MegaChriz commentedIt's surely isn't impossible, but what you request is not provided by Ubercart Addresses.
You can get the requested functionality by writing your own module. You will need to invoke hook_user() in it. Inside that function, when the operation ($op) is 'form', you need to return the form that provides the fields for two addresses and when the operation is 'submit' you will need to save the addresses. (I guess you want to set the nickname of the first address to 'delivery' and the second one to 'billing'.) Check the code in Ubercart Addresses to see how it implemented hook_user() to get the idea.
Providing a checkbox for 'My billing address is the same as my delivery address' will be a little harder to implement, because you will need to add some javascript to the form. You probably can use how Ubercart implemented this for the checkout page as an example. Check uc_cart/uc_cart_checkout_pane.inc and especially study the functions uc_checkout_pane_delivery() and uc_checkout_pane_billing(). Around line 325 (Ubercart 2.4) the code for the checkbox is added. When the checkbox is clicked, the javascript function uc_cart_copy_address() is called, which you can find in uc_cart/uc_cart.js.
Well, your request is not easy to implement. I hope you find my hints useful and help you enough on the way.
Comment #3
freixas CreditAttribution: freixas commentedI don't think MegaChriz has it quite right. Sure, you can write your own code to capture two addresses during registration. But these two addresses won't mean anything special to uc_addresses—in other words, uc_addresses won't pre-fill one for billing and one for shipping. You could, of course, also hack the database to store the address type and hack the checkout code to prefill based on these types, but then you will also need to hack the module to allow users to change which addresses are used for billing and shipping. By this point, you will have done quite a bit of hacking.
I've added the concept of having a default shipping and a default billing address to my plans for the next revision of uc_addresses.
Comment #4
ColinMctavish CreditAttribution: ColinMctavish commentedHey Guys,
Thanks so much for the replies. I have no coding experience, so it wouldn't be possible on my end. However, your responses let me know what is and isn't possible at the moment. I have a webform for Wholesale users to sign up for a wholesale user role. I just thought it would be easier to gather that info at sign up and then augment the role to wholesale user after reviewing the information, instead of "re" signing up the user from scratch every time. Since it is imperative that I have a Billing and Shipping address for my wholesale clients, I suppose I will stick with the webform at the moment.
Thanks again
Comment #5
freixas CreditAttribution: freixas commentedComment #6
MegaChriz CreditAttribution: MegaChriz commentedThe 6.x-2.x and 7.x-1.x versions now support default shipping and default billing addresses. However, on user registration, Ubercart Addresses still presents one address form only. Is it still desired to able to ask for two addresses at user registration? I personally don't need this feature, so I would say this feature should go in a custom module. But if enough people have need for it, I may reconsider to add this to the module. If that's the case, then the first step would be to come with a proposal of how you would like this feature to work. Maybe as how I described it in #2. After that, patches are welcome. Until then, this issue is postponed.
Comment #7
jvieille CreditAttribution: jvieille commentedRegistration shall be consistent with checkout requirements IMHO
+1 for this feature!
Comment #8
ColinMctavish CreditAttribution: ColinMctavish commentedI need it because my customers often have a shipping and billing address. It would be alot more streamlined.
Comment #9
MegaChriz CreditAttribution: MegaChriz commentedI've updated the issue summary, so it's clear what's the next step for this issue. I'm focussing on other issues right now (Views integration), so I will not have time soon to work on this. It's also possible that this feature may not make it in the end, as from July 1, 2013 I'd like to move my focus to Drupal 8. See also #1910860: Ubercart Addresses roadmap for more information about my plans with this module.
Comment #9.0
MegaChriz CreditAttribution: MegaChriz commentedby MegaChriz: Created issue summary.