First and Last name instead of full name ?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sacards.com
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 28
Joined: Wed Jun 04, 2008 1:45 am

First and Last name instead of full name ?

Post by sacards.com » Mon Jul 07, 2008 4:00 am

Hi,
in the checkout page , for non-registerd users , is it possible to replace Full name with First Name , and Last Name ?
the reason is that i noticed too many customers only entering thire first name . It's better to have first and last name , as it became standard in most webforms

Thanks !

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: First and Last name instead of full name ?

Post by jmestep » Mon Jul 07, 2008 7:43 am

We had that problem also. Here is what I changed our onepage checkout to:
OnePageCheckout.ascx

Code: Select all


                                    <h2 class="sectionHeader">Billing Address</h2>
                                    <asp:PlaceHolder ID="EnterBillingPanel" runat="server" EnableViewState="False">
                                        <table class="inputForm" cellpadding="3">
                       <tr>                        
                        <th class="rowHeader" width="100">
                            <asp:Label ID="BillToFirstNameLabel" runat="server" Text="First Name:" AssociatedControlID="BillToFirstName" EnableViewState="false"></asp:Label>
                        </th>
                        <td width="120">
                            <asp:TextBox ID="BillToFirstName" runat="server" EnableViewState="false" Width="110"></asp:TextBox> 
                            <asp:RequiredFieldValidator ID="FirstNameRequired" runat="server" Text="*"
                                ErrorMessage="Billing first name is required." Display="Static" ControlToValidate="BillToFirstName"
                                EnableViewState="False" SetFocusOnError="false" ValidationGroup="OPC"></asp:RequiredFieldValidator>
                        </td>
                        <th class="rowHeader" width="100">
                            <asp:Label ID="BillToLastNameLabel" runat="server" Text="Last Name:" AssociatedControlID="BillToLastName" EnableViewState="false"></asp:Label>
                        </th>
                        <td width="120">
                            <asp:TextBox ID="BillToLastName" runat="server" EnableViewState="false" Width="110"></asp:TextBox> 
                            <asp:RequiredFieldValidator ID="LastNameRequired" runat="server" Text="*"
                                ErrorMessage="Billing last name is required." Display="Static" ControlToValidate="BillToLastName"
                                EnableViewState="False" SetFocusOnError="false" ValidationGroup="OPC"></asp:RequiredFieldValidator>
                        </td>
                    </tr>

   
OnePageCheckout.ascx.cs

Code: Select all

 private void InitializeBillingAddress()
    {
        User user = Token.Instance.User;
        Address billingAddress = user.PrimaryAddress;
        //BillToName.Text = billingAddress.FullName;
        // next 2 lines jme 061908
        BillToFirstName.Text = billingAddress.FirstName;
        BillToLastName.Text = billingAddress.LastName;
        BillToCompany.Text = billingAddress.Company;
        BillToAddress1.Text = billingAddress.Address1;
        BillToAddress2.Text = billingAddress.Address2;
        BillToCity.Text = billingAddress.City;
        BillToPostalCode.Text = billingAddress.PostalCode;
        if (!billingAddress.IsValid) billingAddress.Residence = true;
        BillToAddressType.SelectedIndex = (billingAddress.Residence ? 0 : 1);
        BillToPhone.Text = billingAddress.Phone;
        BillToEmail.Text = billingAddress.Email;
        //INITIALIZE BILLING COUNTRY AND PROVINCE
        BillToCountry.DataSource = this.Countries;
        BillToCountry.DataBind();
        if (billingAddress.CountryCode.Length == 0) billingAddress.CountryCode = Token.Instance.Store.DefaultWarehouse.CountryCode;
        SelectCountryAndProvince(BillToCountry, billingAddress.CountryCode, false, BillToProvince, BillToProvinceList, BillToPostalCodeRequired, billingAddress.Province, false);
    }
------------------------

  private void SaveBillingAddress()
    {
        User user = Token.Instance.User;
        Address billingAddress = user.PrimaryAddress;
        //billingAddress.FullName = StringHelper.StripHtml(BillToName.Text);
        //jme 061908 next two lines 
        billingAddress.FirstName = StringHelper.StripHtml(BillToFirstName.Text);
        billingAddress.LastName = StringHelper.StripHtml(BillToLastName.Text);
        billingAddress.CountryCode = BillToCountry.SelectedValue;
        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.Visible ? StringHelper.StripHtml(BillToProvince.Text) : BillToProvinceList.SelectedValue);
        billingAddress.PostalCode = StringHelper.StripHtml(BillToPostalCode.Text);
        billingAddress.Residence = (BillToAddressType.SelectedIndex == 0);
        billingAddress.Phone = StringHelper.StripHtml(BillToPhone.Text);
        if (trEmail.Visible) billingAddress.Email = StringHelper.StripHtml(BillToEmail.Text);
        billingAddress.Save();
    }

Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

Post Reply