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

Thread: Renaming Shipping Method Titles/Names

  1. #1
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Question Renaming Shipping Method Titles/Names

    How can the shipping methods displayed in the checkout process be renamed? For instance, if I want to calculate shipping using FedEx yet I actually ship via USPS, UPS, and FedEx depending on the item, I wouldn't want the checkout to have "FedEx Ground Service" as the shipping option display. I would rather it display "Ground Shipping" which is more generic, yet still have that option be the "FedEx Ground Service" option as far as the storefront/site can see.

    This is a simple display issue as the functionality of my shipping system is fine. I tried to look up the shipping names/titles as string resources, but they are not there. Can anyone please advise on this?

  2. #2
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    In current versions, there are a couple ways to do this.
    1. Open up the RTShipping class (requires source), and modify the names as they are retrieved from the carrier before they are added to the shipping method collection.
    2. Find the ShipMethods string that is set by the cart.GetShippingMethodList method in the InitializePageContent method in checkoutshipping.aspx.cs (does not require source). Create a list of known shipping methods that you would want to change, and do a String.Replace on that value replacing the shipping method names with the ones you'd like to display.
    In our next version, you'll be able to change shipping methods by using AddIns, which we've developed on the .NET System.AddIn framework that allows you to develop "AddIns" to modify core logic without actually touching any code. Shipping is one of these areas and an AddIn to do this could be done in only a few lines of code, and would be upgrade safe
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  3. #3
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    I am no expert, can you confirm or correct this attempt for me? I won't be surprised if this is 100000% wrong. I just thought I should give it a try before asking for a tutorial!

    C#/VB.NET Code:
                    String ShipMethods cart.GetShippingMethodList(String.Empty, out AnyShippingMethodsFound);
                        {
                            
    ShipMethods ShipMethods.Replace("FedEx Ground Service""Ground Shipping");
                        }
                    
    ShippingOptions.Text ShipMethods

  4. #4
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    Can someone let me know about my attempt above? What is the correct way to go about this?

  5. #5
    Upscale_Automotive is offline Senior Member
    Join Date
    Apr 2008
    Posts
    201

    Default

    After looking at this again, I am still just a lost

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

    Default

    Try this. In checkoutshipping.aspx in the InitializeShippingMethodDisplayFormat method, add the bolded line below where shown:

    Code:
            private void InitializeShippingMethodDisplayFormat(ShippingMethodCollection shippingMethods)
            {
                foreach (ShippingMethod shipMethod in shippingMethods)
                {
                    string freightDisplayText = string.Empty;
                    
                    if (!string.IsNullOrEmpty(ThisCustomer.CurrencySetting))
                    {
                        freightDisplayText = Localization.CurrencyStringForDisplayWithExchangeRate(shipMethod.Freight, ThisCustomer.CurrencySetting);
                        if (shipMethod.ShippingIsFree && Shipping.ShippingMethodIsInFreeList(shipMethod.Id))
                        {
                            freightDisplayText = string.Format("({0})", AppLogic.GetString("shoppingcart.aspx.16", SkinID, ThisCustomer.LocaleSetting));
                        }
    
                        if (cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.AllDownloadItems || cart.FreeShippingReason == Shipping.FreeShippingReasonEnum.AllOrdersHaveFreeShipping)
                        {
                            freightDisplayText = string.Empty;
                        }
                    }
                    shipMethod.Name = shipMethod.Name.Replace("FedEx Ground Service", "Whatever you want to call it instead");
    
                    shipMethod.DisplayFormat = string.Format("{0} {1}", shipMethod.Name, freightDisplayText);
                }
            }
    Obviously you'll want to fix the replacement text, but that should work for you. You can add more lines right after that one if there are more names you want to change.