Address Book... Any way to default to Customer Address?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 13 años
When a user sets up an account, it asks for their address once on the first page.

But then there's this other tab on the Customer Account screen called "Customer Addresses" where the user is prompted to reenter (most of the time shipping & billing should be the same as the main customer address) their address again TWICE.  Once for billing, once for shipping.  This process in itself is not very flowing since when you add an addres, you're taken to a completely differnt screen (complete with left navigation).  The user could get "lost" so to speak.

In any case, it just me, or do other's think this is too much data entry.  Personally, as a customer, it would turn me off from ordering.

How difficult would it to add two checkboxes on the main Customer Account screen that said

Check if billing address is the same
Check if shipping address is the same

At which point, when the customer saves, two new Address records are created along with saving the other customer data.  This would be the easiest

OR

Just save the boolean value of the "Same BillTo", "Same ShipTo" and at checkout, the checkout routine loads the address info from the CustomerAttribute file.


If they don't specify either the billing or shipping address, then when they check out, they again have to enter their address.  This wouldn't be so bad, except I know that the computer knows their address because the Tax is being calculated on the first screen of the shopping cart.
Hace 13 años
I could really use an answer on this as well.

From a customer perspective....filling in address 3 times is too much and I would go someplace else to buy.

Anybody? Please?

Thanks!
Hace 13 años
Hi,

It may depend on the version you have... I guess. If you have 1.60, Check out the 'SelectAddress' method in the CheckoutBillingAddress.ascx.cs file of a brand new project. I believe it induces the behavior you want to achieve.

If you'd rather have checkboxes do the work, you'll find it much easier if you have Visual Studio Express and C# (both free from Microsoft Downloads) installed: it provides designers so you can grab a checkbox control from a toolbar and drop it where you need it on your form. With code similar to that of 'SelectAddress' you should succeed.

The method is called twice: once in btnSelect_Command() and anoter call in btnNextStep_Click(), and starts like this:

            if (billingAddress == null)
            {
                NopContext.Current.User = CustomerManager.SetDefaultBillingAddress(NopContext.Current.User.CustomerId, 0);
                var args1 = new CheckoutStepEventArgs() { BillingAddressSelected = true };
                OnCheckoutStepChanged(args1);
                if (!this.OnePageCheckout)
                    Response.Redirect("~/checkoutshippingmethod.aspx");
                return;
            }

In other words, from what I understand if the user clicks the 'Next Step' button with all fields empty, it 'sets the default billing address', apparently from NopContext.Current.User.CustomerId. The next lines raise an 'OnCheckoutStepChanged' event specifying that a 'Billing address is now selected'. This method looks like it's recursive: by raising that event, the handler probably sends the thread to the btnNextStep_Click() method, which calls the 'SelectAddress' method again, this time with a valid billingAddress.

If you haven't tweaked this part of the code, the simplest way to clarify this to the user might just be to put a label below the 'Next Step' button, mentioning this behavior.

Now I have exactly 3 hours of experience with nopCommerce, so I may be totally wrong here and, well, I'm curious to know whether my assumptions are right. Anyone?
Hace 13 años
Sorry, that didn't work for me, so here is my first MOD

In Nop version 1.80
In ..\Modules\AddressEdit.ascx.cs
Around line 43 Find this:

                 if (IsNew)
                {
                    lblShippingAddressId.Text = string.Empty;
                    txtFirstName.Text = string.Empty;
                    txtLastName.Text = string.Empty;
                    txtPhoneNumber.Text = string.Empty;
                    txtEmail.Text = string.Empty;
                    txtFaxNumber.Text = string.Empty;
                    txtCompany.Text = string.Empty;
                    txtAddress1.Text = string.Empty;
                    txtAddress2.Text = string.Empty;

                    txtCity.Text = string.Empty;
                    txtZipPostalCode.Text = string.Empty;
                    if (IsBillingAddress)
                        this.FillCountryDropDownsForBilling();
                    else
                        this.FillCountryDropDownsForShipping();
                    this.FillStateProvinceDropDowns();

                }


And change it to this:

                 if (IsNew)
                {
                    lblShippingAddressId.Text = string.Empty;
                    txtFirstName.Text = string.Empty;
                    txtLastName.Text = string.Empty;
                    txtPhoneNumber.Text = string.Empty;
                    txtEmail.Text = string.Empty;
                    txtFaxNumber.Text = string.Empty;
                    txtCompany.Text = string.Empty;
                    txtAddress1.Text = string.Empty;
                    txtAddress2.Text = string.Empty;

                    txtCity.Text = string.Empty;
                    txtZipPostalCode.Text = string.Empty;
                    if (IsBillingAddress)
                        this.FillCountryDropDownsForBilling();
                    else
                        this.FillCountryDropDownsForShipping();
                    this.FillStateProvinceDropDowns();

                    ////MOD_DEF> Default values
                    var customer = CustomerManager.GetCustomerById(NopContext.Current.User.CustomerId);
                    if (customer != null)
                    {
                        this.lblShippingAddressId.Text = "0";
                        this.txtFirstName.Text = customer.FirstName;
                        this.txtLastName.Text = customer.LastName;
                        this.txtPhoneNumber.Text = customer.PhoneNumber;
                        this.txtEmail.Text = customer.Email;
                        this.txtFaxNumber.Text = customer.FaxNumber;
                        this.txtCompany.Text = customer.Company;
                        this.txtAddress1.Text = customer.StreetAddress;
                        this.txtAddress2.Text = customer.StreetAddress2;
                        this.txtCity.Text = customer.City;
                        CommonHelper.SelectListItem(this.ddlCountry, customer.CountryId);
                        CommonHelper.SelectListItem(this.ddlStateProvince, customer.StateProvinceId);
                        this.txtZipPostalCode.Text = customer.ZipPostalCode;
                    }
                    //MOD_DEF<
                }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.