Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-16-2008 21:19:26

wyattea
Member
Registered: 01-07-2006
Posts: 1650

add phone number field to delivery address?

I need to collect the phone number of the delivery address provided.  99% of my orders will ship to a different address than billing so I need the phone number field added in the 'delivery address: contact' or 'delivery address: location' area - whether they are adding a delivery address when they click on 'ship to a different address' during checkout or whether it's when they enter a new delivery contact in their address book.

Anyone know where to add this?

Regards,

James...

Offline

 

#2 05-16-2008 23:08:10

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

Go to the raw database admin and add a new field to the address book form in the database khxc_formfields. Clone an existing field like ccp0.addbookins.city to get a new field added to the delivery input.

John

Offline

 

#3 05-17-2008 06:49:40

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

John, I added it, it was available to enter a phone number, but it's not seen anywhere.  Not in the email, not in the 'manage online orders' section - if i log into my user account and review my address book, it doesn't show up there either.  Here's one url that i'm guessing means I have to add it to the addbookupd namespace?  Do I just add the field exactly like I did for addbookins? How many do i have to cover?
https://www.grenvillestation.com/index. … 24d79088b0

Regards,

James...

Offline

 

#4 05-17-2008 11:29:03

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

Yes add the one for the addbookup field the same as  you did for the other which will get in the address update field. It then should be in the array for billing, I think, then you should be able to get it into what you want. It's not going to show up automatically in the email since the email does not set that field so you will have to edit the mail includes to get what you want.

John

Offline

 

#5 05-17-2008 11:40:27

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

what about the {SESSION:phone} thing...something like that....can't check, sending from phone

Offline

 

#6 05-17-2008 22:27:16

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

John, I created ccp0.addbookupd.phone and it showed up when I went to 'add' a new entry in the address book but when I go and click 'update' on the address entry, it doesn't show the phone number.  The field is still there, it's the same namespace (addbookupd) in the url but it's blank while all other fields are showing the data. 

James...

Offline

 

#7 05-18-2008 08:47:02

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

I have done some checking and to get the information into the deliver address info you will need to make some edits to the functions addbookinsp and addbookupdp which is in your private_dir/khxc/apps/ccp0/CCP/ext/addbook.php where the code is:

Code:

// +--
// | Add the address to our book.
// +--

$xbook = array('fname'      => $form_data['fields'][$this->app . '.addbookins.fname'],
               'lname'      => $form_data['fields'][$this->app . '.addbookins.lname'],
               'company'    => $form_data['fields'][$this->app . '.addbookins.company'],
               'addone'     => $form_data['fields'][$this->app . '.addbookins.addone'],
               'addtwo'     => $form_data['fields'][$this->app . '.addbookins.addtwo'],
               'city'       => $form_data['fields'][$this->app . '.addbookins.city'],
               'stateprov'  => $form_data['fields'][$this->app . '.addbookins.stateprov'],
               'country'    => $form_data['fields'][$this->app . '.addbookins.country'],
               'postalcode' => $postalcode,
               'rescom'     => $form_data['fields'][$this->app . '.addbookins.rescom'],
               'phone'      => $form_data['fields'][$this->app . '.addbookins.phone']);

I haven't as of yet checked on getting the info into the email but I will look at doing this.

John

Offline

 

#8 05-18-2008 19:44:58

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

hmmm...i made the change to the code above and the exact same change in the file to the addbookupd. code and when I visited the 'ship to different address page, it displayed in text only with no pictures/header/footer/sidebar - just text on the page.  I replaced it with my original backup file and it was back to normal so adding the info didn't work.

Offline

 

#9 05-18-2008 21:51:54

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

If all you got was text on the page then you had a syntax error in the code you placed. I have it working on my site but I still haven't tracked down how to get it the phone number into the emails or any display for that matter. It's starting to look more complex than just getting the number into the serialized address file.

John

Offline

 

#10 05-18-2008 22:18:03

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

i cut and pasted your text...i'll re-check my copy...at least i'd be able to log into the cart orders and see the number correct? (even if it doesn't come through in email?

Thanks John

James...

Offline

 

#11 05-18-2008 22:40:27

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

Ok, i discovered I didn't change the previous entry's ';' to a ',' (because it was no longer the last entry, but i'm still getting the error...maybe you can spot my error?:

edit: i also missed the parenthesis on the second try smile - got it working!  Hopefully email option isn't a huge issue.

James...

Last edited by wyattea (05-18-2008 22:42:16)

Offline

 

#12 05-19-2008 21:53:49

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

ok, even though I got it working, it's not actually showing up anwhere that I've seen.  I created an order, then logged into that account and went to delivery address book and there was no phone number field.  i reverted back to backup files since it'll just confuse the customer if they enter a phone number and then get an email or phone call from us asking for it - hopefully email option AND 'display wherever address is displayed' option are both not huge issues :0

James...

Offline

 

#13 05-20-2008 00:10:02

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

Well I have gotten it to display on the first page of the checkout screen but it looses it on the second page and as of yet I have not been able to track it down.

John

Offline

 

#14 05-20-2008 16:21:26

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

This one was just about to drive me crazy. Besides doing the above additions to the code in post 7 you will also need to make edits to the Function: get_addressdisp in private_dir/khxc/apps/ccp0/CCP/CCP.php:

Code:

     if ($address['stateprov'] == $spna) {

          $addy .= $this->KHXC_Display->xhtml_encode($address['country']) . ' ';
          $addy .= $this->KHXC_Display->xhtml_encode($address['postalcode']) . '<br />';
          $addy .= $this->KHXC_Display->xhtml_encode($address['phone']);

     } else {

          $addy .= $this->KHXC_Display->xhtml_encode($address['stateprov']) . ' ';
          $addy .= $this->KHXC_Display->xhtml_encode($address['postalcode']) . '<br />';
          $addy .= $this->KHXC_Display->xhtml_encode($address['country']) . '<br />';
          $addy .= $this->KHXC_Display->xhtml_encode($address['phone']);

     } // End of if statement.

and a little further down for the text email if you want:

Code:

     if ($address['stateprov'] == $spna) {

          $addy .= $address['country'] . ' ';
          $addy .= $address['postalcode'];
          $addy .= $address['phone'];

     } else {

          $addy .= $address['stateprov'] . ' ';
          $addy .= $address['postalcode'] . $eol;
          $addy .= $address['country'];
          $addy .= $address['phone'];

     } // End of if statement.

Then you will need to edit the order summaries that you want it into and change the ship_addys array:

Code:

              $ship_addy = array('fname'      => $item['fname'],
                                  'lname'      => $item['lname'],
                                  'company'    => $item['company'],
                                  'addone'     => $item['addone'],
                                  'addtwo'     => $item['addtwo'],
                                  'city'       => $item['city'],
                                  'stateprov'  => $item['stateprov'],
                                  'country'    => $item['country'],
                                  'postalcode' => $item['postalcode'],
                                  'phone'      => $item['phone']);

Now  you need to go to your private_dir/khxc/apps/ccp0/CCP_Checkout/CCP_Checkout.php in  Function: cowriteorder and add the phone code in three places:

Code:

     $fname      = '';
     $lname      = '';
     $company    = '';
     $addone     = '';
     $addtwo     = '';
     $city       = '';
     $stateprov  = '';
     $country    = '';
     $postalcode = '';
     $rescom     = '';
     $phone      = '';

and

Code:

               $fname      = $address['fname'];
               $lname      = $address['lname'];
               $company    = $address['company'];
               $addone     = $address['addone'];
               $addtwo     = $address['addtwo'];
               $city       = $address['city'];
               $stateprov  = $address['stateprov'];
               $country    = $address['country'];
               $postalcode = $address['postalcode'];
               $rescom     = $address['rescom'];
               $phone  = $address['phone'];

and

Code:

     // +--
     // | Format the data array.
     // +--

     $data = array('id'            => $this->cosess['order_number'] . '-' . $cartid,
                   'orderid'       => $this->cosess['order_number'],
                   'epochorder'    => $this->globals('khxc_datetime.epoch'),
                   'shipstatus'    => $shipstatus,
                   'shipmethod'    => $shipmethod,
                   'itemname'      => $item['name'],
                   'itemnum'       => $item['number'],
                   'itemid'        => $item['id'],
                   'itemquan'      => $item['quantity'],
                   'itemopts'      => $itemoptions,
                   'ordertotal'    => $this->price_round($item['subtotal']),
                   'recurtotal'    => $this->price_round($item['subtotalrec']),
                   'fname'         => $fname,
                   'lname'         => $lname,
                   'company'       => $company,
                   'addone'        => $addone,
                   'addtwo'        => $addtwo,
                   'city'          => $city,
                   'stateprov'     => $stateprov,
                   'country'       => $country,
                   'postalcode'    => $postalcode,
                   'rescom'        => $rescom,
                   'cartdata'      => serialize($item),
                   'phone'         => $phone);

Now last but not least you will need to add a new column to the database ccp0_orderitems which should be named phone from the code above. I have been in a lot of places in the code in the last few days but this should get it working. The delivery address display will look like:

name
address1
address2
city, state, zip
country
phone number

John

Offline

 

#15 05-20-2008 17:21:19

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

Thanks John! I haven't tried it yet but i'll post an update once I do (need block of time without 6 year old in the 'area' so I can focus smile)

Regards,

James...

Offline

 

#16 05-20-2008 18:03:45

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

John, could you give me the sql query to add the column...I'm a little green on sql and don't want to screw it up (i don't have a 'dev' system setup yet smile) - also, will it affect current orders since the new phone field will be required (required flag set to 1).

Regards,

James...

[EDIT]: discovered the 'maintain' option smile, it's done. Now to test.

Last edited by wyattea (05-20-2008 18:11:07)

Offline

 

#17 05-20-2008 19:02:39

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

If you set the phone fields to be required in the entry and update screens that is the only place it will be required since there is not other check for that field information, although you could add it if you wanted to. It will not affect older orders, they just want have a phone number in the delivery section since there database entry doesn't hold that info. But if you know there numbers and want them to display it you can put that information into the database.

John

Offline

 

#18 05-20-2008 19:17:44

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

Works, just created an order and then logged into account and it's shown in the address book. Just out of curiosity, if I wanted to add another field, say for example that address book entry's favourite color, then we just duplicate the phone field steps correct?

Thanks again John!

James...

Offline

 

#19 05-20-2008 19:53:39

BigDog
Member
From: central Tennessee, USA
Registered: 10-03-2007
Posts: 240
Website

Re: add phone number field to delivery address?

Hey James. That was a lot of jumping thru hoops and code just for a phone number! The dust ain't settled (or the code ain't been used) and now you want to add another field and more pain?  Take a break and go play with the 6 year old.

Still working on my site. After removing the extra text on my splash page I some how got out of XHTML compliant. 
Seems like I have an extra /td or two and a few extra /tr floating around. I'm checking code  tongue  but I don't think I am having as much fun as you.

BigDog..

Offline

 

#20 05-20-2008 20:10:49

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

Not sure why you would want a color choice in the address book entries but yes doing what you did for the phone number would get any info into and out of that database.

John

Offline

 

#21 05-20-2008 20:32:50

wyattea
Member
Registered: 01-07-2006
Posts: 1650

Re: add phone number field to delivery address?

man, it was like one step forward, two steps back trying to stay within xhtml compliance when I was setting up my skin changes.   regarding the extra field, it was hypothetical, i don't know of anything I want to add right now but with a 'gift basket business', the thing that popped into my head when I thought of asking the question was the recipient's birthday (delivery address = recipient address) but that doesn't help if they're sending a get well gift.  It's just nice to know that if I want to add something else, I know how to do it now.

phone number sounds minimally important but we have to enter a phone number when we create a fedex manifest (especially important for home delivery because the recipient might not be home during business hours when fedex attempts delivery) so it was a very important update.

James...

6 year old is sleeping (it's 9:30pm est) smile

Last edited by wyattea (05-20-2008 20:33:27)

Offline

 

#22 05-20-2008 22:37:55

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

Well Fedex an UPS both want delivery phone numbers to create a shipping label .That is why I went looking for the answer since I have hit that problem my self. So in a way helping you is helping me solve a problem too.

John

Last edited by dh783 (05-20-2008 22:38:13)

Offline

 

#23 06-01-2010 21:05:52

mc3537
Member
Registered: 09-02-2009
Posts: 11

Re: add phone number field to delivery address?

Just wondering if this update works equally well with V7?
I have followed all of Jame's steps and have had the same results, right down to syntax errors.
Now I have become a little lost on the coding. I can not find the Function: get_addressdisp, either in ECOM.php or CORE.php.
Since CCP.php has been replaced in version 7, has the function also been changed, or is it located somwhere else now?

Offline

 

#24 06-01-2010 22:12:44

dh783
Member
From: Avondale, Arizona
Registered: 04-06-2005
Posts: 6233
Website

Re: add phone number field to delivery address?

In ccp7 Function: get_addressdisp in located in CORE_App/CORE_App.php.

John

Offline

 

Board footer