Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 10 of 10

Thread: Customer Editing Billing Address

  1. #1
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default Customer Editing Billing Address

    We have customers who already have a PO address setup for billing. If they attempt to change this to a different PO billing address they get the following error.

    Some errors occured trying to update your address. Please correct them and try again.

    • P.O. Box ship-to addresses are not supported. Please enter a full street residential or commercial address. Thanks

    Ive duplicated this, why does updating billing think it is updating shipping?

    Im on 8.0.1.2

  2. #2
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    What's the value of the AppConfig: DisallowShippingToPOBoxes and AppConfig: AllowShipToDifferentThanBillTo?

  3. #3
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    DisallowShippingToPOBoxes was true, ive now set it to false to get around this issue

    AllowShipToDifferentThanBillTo is true

  4. #4
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    I should clarify, entering a PO for a billing address as brand new works fine. The issue is only when a customer with a PO billing address tries to change that address to a different PO.

  5. #5
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    If Appconfig: DisallowShippingToPOBoxes is true, the warnings you're getting is the expected behavior. If there has been existing PO box addresses in that particular customer, he/she might have done it just before you turn on that appconfig. If you're not really restricting PO box address, then you should turn that off.

  6. #6
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    The addresses that are in with a PO were brought in using WSI during initial setup.

    Im very puzzled though as to why this would be expected behavor, the appconfig is DisallowSHIPPINGToPo ... it would be very realistic to have billing PO but not want to allow shipping to a PO. In addition, changing the Billing Address should never ever give an error referencing the Shipping Address ... that is very confusing.

  7. #7
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    That's only happening upon editing an existing billing PO box address, right? Open up your EditAddress.aspx.cs file.

    From ValidateAddress1() method, change these lines:

    Code:
    String Adr1 = txtAddress1.Text;
    Adr1 = Adr1.Replace(" ", "").Trim().Replace(".", "");
    bool IsPOBoxAddress = (Adr1.StartsWith("pobox", StringComparison.InvariantCultureIgnoreCase) || Adr1.StartsWith("box", StringComparison.InvariantCultureIgnoreCase) || Adr1.IndexOf("postoffice") != -1);
    bool RejectDueToPOBoxAddress = (IsPOBoxAddress && AppLogic.AppConfigBool("DisallowShippingToPOBoxes")); // undocumented feature 
    args.IsValid = !RejectDueToPOBoxAddress;
    to:
    Code:
    bool AllowShipToDifferentThanBillTo = false;
    AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo") && !AppLogic.AppConfigBool("SkipShippingOnCheckout");
    
    if (!AllowShipToDifferentThanBillTo)
       {
         String Adr1 = txtAddress1.Text;
         Adr1 = Adr1.Replace(" ", "").Trim().Replace(".", "");
         bool IsPOBoxAddress = (Adr1.StartsWith("pobox", StringComparison.InvariantCultureIgnoreCase) || Adr1.StartsWith("box", StringComparison.InvariantCultureIgnoreCase) || Adr1.IndexOf("postoffice") != -1);
          bool RejectDueToPOBoxAddress = (IsPOBoxAddress && AppLogic.AppConfigBool("DisallowShippingToPOBoxes")); // undocumented feature 
          args.IsValid = !RejectDueToPOBoxAddress;
         }
    As always, make a backup first before doing any changes.

  8. #8
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    Yep, only when editing an existing po box address.

    Ill give your code a shot, thanks!!

  9. #9
    ssgumby is offline Senior Member
    Join Date
    Feb 2009
    Posts
    683

    Default

    Worked perfectly Alfred, thanks again!

  10. #10
    brightspectrum is offline Member
    Join Date
    Feb 2008
    Location
    Seattle, WA
    Posts
    41

    Default

    Just as a follow up on this old thread. A change has to take place in two places so that it will also work when a user is making an update to their account on the selectaddress.aspx page. So you must also do the following.

    On the selectaddress.aspx.cs change this
    Code:
    private bool ValidateAddress(string address)
            {
                address = address.Replace(" ", "").Trim().Replace(".", "");
                bool IsPOBoxAddress = (address.StartsWith("pobox", StringComparison.InvariantCultureIgnoreCase) || address.StartsWith("box", StringComparison.InvariantCultureIgnoreCase) || address.IndexOf("postoffice") != -1);
                bool RejectDueToPOBoxAddress = (IsPOBoxAddress && AppLogic.AppConfigBool("DisallowShippingToPOBoxes")); // undocumented feature
    
                return RejectDueToPOBoxAddress;
            }
    To this:
    Code:
    private bool ValidateAddress(string address)
            {
                bool AllowShipToDifferentThanBillTo = false;
                bool RejectDueToPOBoxAddress = false;
                AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo") && !AppLogic.AppConfigBool("SkipShippingOnCheckout");
    
                if (!AllowShipToDifferentThanBillTo)
                {
                    address = address.Replace(" ", "").Trim().Replace(".", "");
                    bool IsPOBoxAddress = (address.StartsWith("pobox", StringComparison.InvariantCultureIgnoreCase) || address.StartsWith("box", StringComparison.InvariantCultureIgnoreCase) || address.IndexOf("postoffice") != -1);
                    RejectDueToPOBoxAddress = (IsPOBoxAddress && AppLogic.AppConfigBool("DisallowShippingToPOBoxes")); // undocumented feature 
                }
               
                return RejectDueToPOBoxAddress;
            }
    Chidozie Bright
    Bright Spectrum Inc
    Bright Ideas. Creative Solutions