Closed (duplicate)
Project:
Ubercart
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Nov 2008 at 08:30 UTC
Updated:
18 Mar 2012 at 20:27 UTC
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
Comment #1
rszrama commentedHah, 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.
Comment #2
jide commentedI 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.
Comment #3
megachrizThis 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.
Comment #4
tr commentedNo, 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.
Comment #5
megachrizThanks 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.
Comment #6
megachrizTR,
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?
Comment #7
tr commentedMarking 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.