How to add, new field to address form?

Posts: 5
Joined: 02/19/2008

Hi all,
I try to create a module which will add 'NIP' (it`s polish tax number) field to address form.
I try to use hook_form_alter, and hook_checkout_pane, I will also try to use module from this thread to store all address information in user profile. I will create separate table with two rows 'uid' and 'nip', to store NIP information.

I need some advise, which form and how I should alter to get something like this:
*First name:
*Last name:
Firm:
NIP:
*Street address:
*City:
*Postal code:
*Phone number:

You have to fill 'NIP' field only if you filled 'Firm' field.

Best regards (and sorry form my English).

Posts: 5617
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I think I would recommend copying/pasting code for the default address pane from the cart module (see uc_cart_cart_pane()) and uc_cart_checkout_pane.inc. You should be able to look at how this works and modify it for your needs. However, it may be more beneficial to just leave the address panes alone and collect the NIP information in a custom checkout pane.

Posts: 5
Joined: 02/19/2008

Hi, thanks for your advice.
But it was not so simple, I couldn`t just add another pane to cart checkout pane because my client didn`t agree.
I have made some changes in uc_store.module, uc_order.module ,uc_cart_checkout_pane.inc and also I`ve wrote module called uc_nip.

Here is a patch (files under ubercart/ are original from beta 4, ), with changes I`ve made, and my uc_nip.module, maybe someone will find it useful.

AttachmentSize
uc_nip.tar50 KB
Posts: 13
Joined: 03/14/2008

Thats exactly what I need right now. But, could you possibly post all changed files, Im struggling with applying the patch. Thanks