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 4 of 4

Thread: Exclude UPS Ground from Method

  1. #1
    peter3827 is offline Senior Member
    Join Date
    Nov 2005
    Posts
    281

    Default Exclude UPS Ground from Method

    Is there a way to exclude UPS Ground if a person is from Hawaii and Alaska? You would think that UPS would automatically not show it. Any help and direction would help. Thanks.

  2. #2
    AspDotNetStorefront Staff - Scott's Avatar
    AspDotNetStorefront Staff - Scott is offline Administrator
    Join Date
    Mar 2007
    Location
    Ashland, OR
    Posts
    2,390

    Default

    If you're using realtime rates from the carrier then they do all of that filtering on their end. If you're using fixed rates, you would have to edit that shipping method by clicking the Set Allowed States button and set up your restrictions.

  3. #3
    peter3827 is offline Senior Member
    Join Date
    Nov 2005
    Posts
    281

    Default

    Yea, I figured that.

  4. #4
    mgibbs is offline Senior Member
    Join Date
    Jan 2005
    Location
    Orange County, CA
    Posts
    194

    Default

    I assume from your reply that you are using RTShipping and that UPS is returning ground options for shipping to those states.

    If that is the case, you can modify the appropriate checkout file. We are doing this for a customer who has certain types of products that can ONLY be shipped to the continental US (no Alaska or Hawaii) and it can only go UPS Ground. We identify the orders that have this class of product and will remove all shipping options except Ground from those returned by the RTShipping function.

    You could do the same, only removing Ground as an option if the shipping state is HI or AK.

    The file you choose to edit will be determined by whether you are using one-page checkout or not. If yes, then edit checkout1.aspx.cs; if no, edit checkoutshipping.aspx (perhaps checkoutshippingmult and mult2 if need be).

    In place of the following call
    C#/VB.NET Code:
    ShippingOptions.Text ShipMethods
    You'll want to check and see if
    C#/VB.NET Code:
    if (ThisCustomer.PrimaryShippingAddress.Country != "United States"
                        
    || ThisCustomer.PrimaryShippingAddress.State == "AK"  // Alaska
                        
    || ThisCustomer.PrimaryShippingAddress.State == "AS"  // American Samoa
                        
    || ThisCustomer.PrimaryShippingAddress.State == "AA"  // Armed Forces, Asia
                        
    || ThisCustomer.PrimaryShippingAddress.State == "AE"  // Armed Forces, Europe
                        
    || ThisCustomer.PrimaryShippingAddress.State == "AP"  // Armed Forces, Pacific
                        
    || ThisCustomer.PrimaryShippingAddress.State == "FM"  // Federated States of Micronesia
                        
    || ThisCustomer.PrimaryShippingAddress.State == "GU"  // Guam
                        
    || ThisCustomer.PrimaryShippingAddress.State == "HI"  // Hawaii
                        
    || ThisCustomer.PrimaryShippingAddress.State == "MH"  // Marshal Islands
                        
    || ThisCustomer.PrimaryShippingAddress.State == "MP"  // Northern Mariana Islands
                        
    || ThisCustomer.PrimaryShippingAddress.State == "PW"  // Palau
                        
    || ThisCustomer.PrimaryShippingAddress.State == "PR"  // Puerto Rico
                        
    || ThisCustomer.PrimaryShippingAddress.State == "VI"  // Virgin Islands
                        

    And if so, loop through the shipmethods string and remove the option for Ground Shipping. You could do that by the following:
    C#/VB.NET Code:
                String[] sDelimiters = { "<br/>" };
                
    String[] shippingMethods ShipMethods.Split(sDelimitersStringSplitOptions.RemoveEmptyEntries);
                
    StringBuilder sbShipMethods = new StringBuilder();

                        foreach (
    string s in shippingMethods)
                        {
                            if (!
    s.Contains("UPS Ground"))
                                
    sbShipMethods.Append("<br/>");
                        }
                        
    ShippingOptions.Text sbShipMethods.ToString(); 
    Since this is a modification/simplification of the code we used to the rather complicated shipping decisions we need to make for this one customer, I hope I didn't introduce any bugs into the code above. However, I'm sure it is complete enough to work for what you need to do.

    Best of luck!

    MJG
    EMM for AspDotNetStorefront - Communicate effectively with your customers