How to pre-fill estimate shipping module with customer's data

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 12 ans
Hello,
Here's a small adjustment that I just realized and that I am sharing.
The goal is to fill the "EstimateShipping" module on load with the country/region/zipcode of the current customer if possible.
In EstimateShipping.ascx.cs, method BindData(), I added in the else part:
if (NopContext.Current.User != null
    && NopContext.Current.User.CountryId != 0
    && !string.IsNullOrEmpty(NopContext.Current.User.ZipPostalCode))
{
    CommonHelper.SelectListItem(ddlCountry, NopContext.Current.User.CountryId);
    FillStateProvinceDropDowns();
    if (NopContext.Current.User.StateProvinceId != 0)
    {
        CommonHelper.SelectListItem(ddlStateProvince, NopContext.Current.User.StateProvinceId);
    }
    this.txtZipPostalCode.Text = NopContext.Current.User.ZipPostalCode;
}

Your comments are welcome (optimization, bug, ...).
Best regards,
Il y a 12 ans
Thanks for this contrib
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.