Help an idiot out! RE:Adding an address field

Posts: 2
Joined: 07/28/2008

Hello, I am trying to change or add an address field in the checkout process (school name and school ID#). How is this done easiest? thanks for your help

Posts: 4
Joined: 08/11/2008

Same question here. I wish to add business number after company name.

Thank you!

Posts: 146
Joined: 11/10/2007
Bug Finder

It would be great to see custom forms fields in check out... Not sure if there a module for that????? If so scratch this post.

If your in a hurry just add your custom fields in store.module starting at line #1569.. I don't recommended it as the core shouldn't be tampered with.

You also have to add the new fields in the array and variable_get

$fields = array(
    'first_name' => array(t('First name'), TRUE),
    'last_name' => array(t('Last name'), TRUE),
    'phone' => array(t('Phone number'), TRUE),
    'company' => array(t('Company'), TRUE),
   
'business_number 'company' => array(t('Business Number'), TRUE),

    'street1' => array(t('Street address 1'), TRUE),
    'street2' => array(t('Street address 2'), TRUE),
    'city' => array(t('City'), TRUE),
    'zone' => array(t('Zone'), TRUE),
    'country' => array(t('Country'), TRUE),
    'postal_code' => array(t('Postal code'), TRUE),
    'address' => array(t('Address'), FALSE),
    'street' => array(t('Street address'), FALSE),
    );

Then add the new custom field to


$current = variable_get('uc_address_fields', drupal_map_assoc(array('first_name', 'last_name', 'phone', 'company', 'business_number', 'street1', 'street2', 'city', 'zone', 'postal_code', 'country')));

Now add the custom field to the database table "variable".

Again not recommended....

ummm. I smell a module being cooked!

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 4
Joined: 08/11/2008

Thank you for your suggestion!

Do I need to add this in more lines???

For expamle here?

  switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':
      $result = db_query("SELECT DISTINCT ". $type ."_first_name AS first_name, "
                   . $type ."_last_name AS last_name, ". $type ."_phone AS phone, "
                   . $type ."_company AS company, ". $type ."_street1 AS street1, "
                   . $type ."_street2 AS street2, ". $type ."_city AS city, "
                   . $type ."_zone AS zone, ". $type ."_postal_code AS postal_code, "
                   . $type ."_country AS country FROM {uc_orders} WHERE uid = %d "
                   ."AND order_status IN ". uc_order_status_list('general', TRUE)
                   ." ORDER BY created DESC", $uid);

Module for this would be so great Smiling

!!!!!!!!!!!!!EDIT!!!!!!!!!!!!!!!!!!!!!!!!
I have edited many places in uc_store and uc_cart. New field appear correctly in admincp, but not in checkout pane.
I believe I need to also hack uc_order but there is so many places that I am afraid to (since I am not a coder ).