Page 1 of 1
Adding fields to billing and shipping information
Posted: Tue Jun 23, 2009 9:37 am
by CASE
We would like to add three additional fields to the billing and shipping addresses in the checkout process - a third address line, a title and a fax. The system should also save this information and allow the user to update it.
Can anyone help?
Thanks!
Re: Adding fields to billing and shipping information
Posted: Tue Jun 23, 2009 9:50 am
by mazhar
Fax field is already there you just need to interface it to UI. There is another unused field Nickname which you use to accommodate your second custom data. So if you cope your requirement with two fields then you need no db and data access change just put some UI code and make use of these fields.
Re: Adding fields to billing and shipping information
Posted: Tue Jun 23, 2009 11:42 am
by CASE
Thanks! Just to clarify, I can only add two new fields without having to make changes in the database?
I've done a test with the fax field and added it to the UI - when I input a number, it goes through to the order detail and is passed through the checkout process, but it doesn't seem to write to the database. When I try and edit the billing address, the number I just put in is no longer there. Same for when I go to make a second order and pull up my address.
I added the following code to the OnePageCheckout.ascx below the phone number field.
<tr>
<th align="left" valign="top" class="rowHeader">Fax:</th>
<td><asp:TextBox ID="BillToFax" runat="server" EnableViewState="false" Width="200px" MaxLength="100"></asp:TextBox> </td>
</tr>
I updated the OnePageCheckout.ascx.cs file by adding fax to the section below. Am I doing something incorrectly, or missing a step?
private bool SaveBillingAddress()
{
string billToProvince;
if (ValidateProvince(BillToCountry, BillToProvince, BillToProvinceList, out billToProvince))
{
User user = Token.Instance.User;
Address billingAddress = user.PrimaryAddress;
billingAddress.FirstName = StringHelper.StripHtml(BillToFirstName.Text);
billingAddress.LastName = StringHelper.StripHtml(BillToLastName.Text);
billingAddress.Company = StringHelper.StripHtml(BillToCompany.Text);
billingAddress.Address1 = StringHelper.StripHtml(BillToAddress1.Text);
billingAddress.Address2 = StringHelper.StripHtml(BillToAddress2.Text);
billingAddress.City = StringHelper.StripHtml(BillToCity.Text);
billingAddress.Province = billToProvince;
billingAddress.PostalCode = StringHelper.StripHtml(BillToPostalCode.Text);
billingAddress.CountryCode = BillToCountry.SelectedValue;
billingAddress.Residence = (BillToAddressType.SelectedIndex == 0);
billingAddress.Phone = StringHelper.StripHtml(BillToPhone.Text);
billingAddress.Fax = StringHelper.StripHtml(BillToFax.Text);
if (trEmail.Visible) billingAddress.Email = StringHelper.StripHtml(BillToEmail.Text);
billingAddress.Save();
_BillToProvinceError = false;
return true;
}
Re: Adding fields to billing and shipping information
Posted: Wed Jun 24, 2009 4:20 am
by mazhar
In order show saved fax information you need to put some load and display code as well. Here is a thread with a complete save/load mod. You need to do same for both Nickname and fax
viewtopic.php?f=42&t=11027
Re: Adding fields to billing and shipping information
Posted: Mon Jul 13, 2009 12:15 pm
by CASE
Maybe I am misunderstanding something, but the code is added and the extra fields don't seem to be passing through the checkout pages. If I return to the edit screen, they are there.
Here is the edit screen (the fields also appear in the address input screen, and if there is data there it is pulled in).
image1.gif
However, when I go to the next screen, the data isn't passed along. I don't know if there is another file I need to edit somewhere, or I am just missing something.
image2.gif
Re: Adding fields to billing and shipping information
Posted: Tue Jul 14, 2009 5:32 am
by mazhar
Check in the database the information you entered will be available there. You need to put some code on edit screen to show information when pages loads, I mean the saved info. Similarly you may also need to update other places where address information is shown to take care of this custom information.
Re: Adding fields to billing and shipping information
Posted: Tue Jul 21, 2009 3:52 pm
by CASE
Do you know where these fields are managed in AbleCommerce (which files?). I've looked everywhere for the page/code that manages the billing and shipping as displayed on this screen, and just don't see it.
Re: Adding fields to billing and shipping information
Posted: Wed Jul 22, 2009 1:58 am
by mazhar
check the OnePageCheckout control files.