I need to add more fields in Address Fields and wondering how to do it using UC (as the creator say: It has been designed with the end user in mind, focusing on usability)???

Comments

rszrama’s picture

Status: Active » Closed (won't fix)

Hah, well, this is more a developer thing than an end-user thing. You might check out the addresses contrib, otherwise you'll need to work out either a customized checkout pane or a hook_form_alter(). At this point, more customizable addresses will have to wait till UC 3.x.

jide’s picture

I have the same problem, i need to add a "gender" field (you can imagine how trivial it seems to implement) and i am stuck with the way address fields are implemented. Using hook_form_alter() or a custom checkout pane is a really difficult task since we need the fields in a lot of places afterwards.
It could have been possible to let developpers alter $fields variables in uc_store_address_fields_form() but fields are hardcoded through a lot of pieces of code.
Too bad this won't be fixed in 2.0 ;) It is a really important feature i think. Maybe it could be an idea to enable a gender field anyway, could be useful to many.

megachriz’s picture

Status: Closed (won't fix) » Needs work

This is really an important feature. Not only do I need the gender field, but also a suffix and a title field.
I'm looking for ways to get those extra address-fields in it right now, but it looks like it can only be done with hacking Ubercart core code.

tr’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Category: support » feature
Priority: Critical » Normal
Status: Needs work » Active

No, you don't have to hack core - you can do it with hook_form_alter() and other standard Drupal mechanisms. I know this is true because I've done it before, but it does involve lots of hooks to change all the places the address fields are used. Making it *easy* to do requires re-architecting how addresses are stored and handled in Ubercart, and that gets us in to question of integration with Profile and/or Location (etc.) as well as incorporation of features currently provided by uc_addresses. And frankly that's going to impact too much code and too many contributions to make this change as a point release of Ubercart 2.x. So I'm moving this issue to the 3.x queue. This change isn't going to happen quickly unless someone steps up to help out on the issue.

megachriz’s picture

Thanks for your answer, TR. I understand that changing the way of how addresses are handled could have much impact on contributed modules.

Good to know that the extra address fields can get in without hacking core. If you have done that before, can you give me an overview of which hooks need to be implemented, or - even better - can you give me the code that made the extra address fields possible? That can save me a lot of time.

As for hacking the core, I was thinking about a hook something like hook_order_pane_alter() to get the extra address fields in (but I'm not sure if that would have been enough).

If I can, I would like to help out on the issue, because it's a really important feature for me. But at this moment, I don't know everything about the Ubercart code, so I'm not sure how I can help yet.

megachriz’s picture

Status: Active » Needs work

TR,

Thanks for the hook 'hook_checkout_pane_alter()'.

Now I have the following problem: how do I override uc_order_address()?

Btw, can you give me the code what you had made to get the extra address fields in?

tr’s picture

Status: Needs work » Closed (duplicate)

Marking this as duplicate of #850630: Incorporate uc_addresses into Ubercart or allow address system to be extended. We only need one issue to track this.