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

Thread: How to change Shipping Zones from 3 digit zip code to 5 digit.

  1. #1
    joia is offline Junior Member
    Join Date
    Nov 2010
    Posts
    7

    Default How to change Shipping Zones from 3 digit zip code to 5 digit.

    We are creating a shopping cart for a small geographic area where we do local delivery with our own trucks. Internally we have already broken up these cities into zones. The problem with the built in 3 digit method is all of these cities share the first 3 digits despite being on completely different delivery routes. I need to change this to read all 5 digits.

    In the appconfig I have changed the zipcodeprefixlength to 5. This is now throwing server errors so there must be some place in the code I need to change it. Any suggestions?

    Here is the error:

    Server Error in '/AspDotNetStorefrontML9' Application.
    Index and length must refer to a location within the string.
    Parameter name: length
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length]
    System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +10081476
    AspDotNetStorefrontCore.Shipping.ZoneLookup(String zip) in C:\workspace\C#\shoppingcartv9\ASPDNSFCore\Shippin g.cs:214
    AspDotNetStorefrontCore.Prices.ShippingTotal(Boole an includeDiscount, Boolean includeTax, CartItemCollection cic, Customer ThisCustomer, IEnumerable`1 OrderOptions) in C:\workspace\C#\shoppingcartv9\ASPDNSFCore\Prices. cs:706
    AspDotNetStorefrontCore.Prices.Total(Boolean includeDiscount, CartItemCollection cic, Customer ThisCustomer, IEnumerable`1 OrderOptions) in C:\workspace\C#\shoppingcartv9\ASPDNSFCore\Prices. cs:926
    AspDotNetStorefrontCore.ShoppingCart.get_TotalRate () in C:\workspace\C#\shoppingcartv9\ASPDNSFCore\Shoppin gCart.cs:516
    AspDotNetStorefrontCore.ShoppingCart.get_TotalRate DisplayFormat() in C:\workspace\C#\shoppingcartv9\ASPDNSFCore\Shoppin gCart.cs:532
    AspDotNetStorefrontControls.CartSummary.AssignData SourceContentToControls(ShoppingCart cart) in C:\workspace\C#\shoppingcartv9\ASPDNSFControls\Car tSummary.cs:409
    AspDotNetStorefrontControls.CartSummary.CreateChil dControls() in C:\workspace\C#\shoppingcartv9\ASPDNSFControls\Car tSummary.cs:78
    System.Web.UI.Control.EnsureChildControls() +146
    System.Web.UI.Control.PreRenderRecursiveInternal() +61
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Control.PreRenderRecursiveInternal() +224
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394

  2. #2
    joia is offline Junior Member
    Join Date
    Nov 2010
    Posts
    7

    Default

    The other error that is a little more helpful and points to the shipping.cs page is this.


    ------
    Index and length must refer to a location within the string.
    Parameter name: length
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length

    Source Error:

    Line 212: -1)
    Line 213: {
    Line 214: String s2 = s.Substring(0, ZipCodePrefixLength);
    Line 215: // single item:
    Line 216: int LowPrefix = 0;


    Source File: C:\shoppingcartv9-MN\ASPDNSFCore\Shipping.cs Line: 214

    Stack Trace:

    [ArgumentOutOfRangeException: Index and length must refer to a location within the string.
    Parameter name: length]
    System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +10081476
    AspDotNetStorefrontCore.Shipping.ZoneLookup(String zip) in C:\shoppingcartv9-MN\ASPDNSFCore\Shipping.cs:214
    AspDotNetStorefrontCore.ShippingCalculation.Shippi ngCalculation.GenerateShippingMethodsQuery(Int32 storeId, Boolean includeZone) in C:\shoppingcartv9-MN\ASPDNSFCore\ShippingCalculation\ShippingCalcula tion.cs:188
    AspDotNetStorefrontCore.ShippingCalculation.Calcul ateShippingByWeightAndZoneShippingCalculation.GetS hippingMethods(Int32 storeId) in C:\shoppingcartv9-MN\ASPDNSFCore\ShippingCalculation\CalculateShippi ngByWeightAndZoneShippingCalculation.cs:49
    AspDotNetStorefrontCore.ShoppingCart.GetShippingMe thods(Address usingThisAddress, Decimal taxRate) in C:\shoppingcartv9-MN\ASPDNSFCore\ShoppingCart.cs:3471
    AspDotNetStorefrontCore.ShoppingCart.GetShippingMe thods(Address usingThisAddress) in C:\shoppingcartv9-MN\ASPDNSFCore\ShoppingCart.cs:3356
    AspDotNetStorefront.checkout1.OnInit(EventArgs e) in c:\shoppingcartv9-MN\web\checkout1.aspx.cs:72
    System.Web.UI.Control.InitRecursive(Control namingContainer) +143
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1477

  3. #3
    joia is offline Junior Member
    Join Date
    Nov 2010
    Posts
    7

    Default

    I resolved the issue. Turns out I had zone ranges that overlapped some of the 5 digit zones I created which was causing the issue. After deleting the junk zones it's working correctly.