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: Any way to exclude a shipping method from the Estimates?

  1. #1
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default Any way to exclude a shipping method from the Estimates?

    I have switched from real-time shipping to shipping rates based on order total. I have three shipping methods, Standard (ground), 2nd Day Air, and In-Store Pickup. The rate for In-Store Pickup is $0.00 and is now the only rate that ever shows up in the Shipping Estimates on the cart page. I want to exclude that method from the Estimates. We also have free shipping over a threshold of $500 so in the case of an order over that amount, the free shipping method is OK to display, but I don't want to ever show In-Store Pickup in the Estimates - is there any way to exclude that shipping method?

    This was never a problem when using real-time shipping as there was special support for the "In-Store Pickup" shipping method - it seems I must be doing something wrong with my new configuration...

    Thanks,
    David

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

    Default

    If you wish to remove the Shipping on the estimate, this is possible. You will have to comment out those element for Shipping display on the SetupShippingAndEstimateControl function of the shoppingcart.aspx.cs; however, this would leave the display to be like this:
    Code:
    {Shipping Estimate Caption} {Shipping Estimate}
    In order for that to be fully removed, you will have to modify the ShippingAndTaxEstimateTableControl.cs class under the ASPDNSFControls and that's it...

  3. #3
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default

    Jao,

    Thanks for the reply but I think you misunderstood my question. I do not want to remove the shipping estimate from the cart, I want to remove a SPECIFIC shipping method from the calculation.

    The reason being is that I have an "In-Store Pickup" shipping method that has a cost of $0.00 and that is the ONLY method that appears in the estimate. I assume the logic is to show the lowest cost shipping, but only a fraction of my customers are local and so it makes the shipping estimate pretty useless for most of my customers. When I was using Real-Time shipping there was specific support for In-Store Pickup as a shipping method and that support was smart enough to exclude from the shipping estimate feature. If there isn't a way to exclude a specific shipping method from the estimate function it seems that it should be an enhancement for the next release. If I can get a workaround that doesn't require me to recompile any assemblies I would appreciate it.

    Thanks,
    David

  4. #4
    amanukian@gmail.com is offline Member
    Join Date
    Mar 2008
    Posts
    45

    Default

    David,

    May I ask how you managed for In-store pickup option not to require shipping address? I too have this option but don't know how to force not to require shipping address to be entered by customer.



    Thank you.
    RMan
    RMan

  5. #5
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default Extra shipping charges

    While we are at it, I'd like to separate "ShippingHandlingExtraFee" from the RTshipping charges. I see ShippingHandlingExtraFee mentioned in AjaxShipping.aspx.cs. for estimates.
    Where else are the calculations (adding the charges together) and where are the charges on the checkout page so I can create another row on the invoice for the cost of UPS shipping and, separately, a single charge for handling the order.

    Can different % increases in the RTshipping real time applying to the different UPS services? Like: 0% inrease for ground shipping and 15% additional for Overnight shipments.

    We had a lot of trouble with people choosing "Store Pickup" as it cost $0 in our old system. Especially foreign customers. We finally had to take Store Pickup out of the shipping choices. Allowing only certain zips is a good idea if people have a bit of common sense not to try and "game" the shipping if they really want it shipped via UPS, even locally.

  6. #6
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    The default logic is to retrieve the shipping method with the lowest freight.
    You would find the code in the shoppingcart.aspx code-behind

    Look for the routine: SetupShippingAndEstimateControl, you would find this line:
    C#/VB.NET Code:
    //The lowest shipping method cost
                    
    ShippingMethod lowestFreightMethod availableShippingMethods.LowestFreight
    availableShippingMethods is a collection of shippingmethods, just assign the variable lowestFreightMethod to whichever one you want.

    That's all you need to modify no need to recompile, just refresh the shoppingcart page.

  7. #7
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default

    Mark,

    Not having the source code is making this tough as I have no idea what these classes look like. It seems that the easiest way to do this would be for me to remove the 'In-Store Pickup" shipping method from the ShippingMethodCollection availableShippingMethods after it is initialized. I have no idea how to remove it from the collection without the benefit of intellisense.

    Given the code below, how would I remove a particular shipping method from the availableShippingMethods collection given it's string name - in this case "In-Store Pickup"?

    ShoppingCart cart = new ShoppingCart(1, thisCustomer,
    CartTypeEnum.ShoppingCart, 0, false);
    //Collect the available shipping method
    ShippingMethodCollection availableShippingMethods =
    cart.GetShippingMethods(thisCustomer.PrimaryShippi ngAddress);

    I assume I could do something like this, but I have no idea what the actual syntax is:

    foreach (ShippingMethod method in availableShippingMethods)
    {
    if (method.ToString() == "In-Store Pickup")
    {
    availableShippingMethods.Remove(method);
    break;
    }
    }

    Is that close? Am I going to have to purchase the source code to be able to figure this out?

    Thanks,
    David

  8. #8
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default

    Quote Originally Posted by amanukian@gmail.com View Post
    David,

    May I ask how you managed for In-store pickup option not to require shipping address? I too have this option but don't know how to force not to require shipping address to be entered by customer.



    Thank you.
    RMan
    RMan,

    I didn't try to solve this. Since the customer has to enter their credit card info and address I just assume they will enter one and check the "same as billing" or something like that. Walk-in business is pretty much the exception for our website so I don't really care if the customer has to type a little extra - most people just walk in and purchase over the retail counter rather than use the website in those cases.

    David

  9. #9
    MarkC is offline Developer
    Join Date
    Aug 2006
    Posts
    166

    Default

    For your purpose, yes you can just modify the returned shipping methods right after the call to cart.GetShippingMethods
    The logic for the estimates is located on the shoppingcart.aspx code-behind, available even without source.

    One thing to note is that, .net won't allow you to remove items in a collection while looping.
    You're on the right track, but you'd need to do something like:


    C#/VB.NET Code:
    ShoppingCart cart = new ShoppingCart(1thisCustomerCartTypeEnum.ShoppingCart0false);
                    
    //Collect the available shipping method
                    
    ShippingMethodCollection availableShippingMethods cart.GetShippingMethods(thisCustomer.PrimaryShippingAddress);

                    
    // temporary collection that will hold only the valid shipping methods
                    
    ShippingMethodCollection temp_validMethods = new ShippingMethodCollection();

                    foreach (
    ShippingMethod shipMethod in availableShippingMethods)
                    {
                        
    // filter out shipping methods that starts with "Express"
                        // and add it to our temp collection
                        
    if (shipMethod.Name.StartsWith("Express") == false)
                        {
                            
    temp_validMethods.Add(shipMethod);                        
                        }
                    }

                    
    // clear out the original
                    
    availableShippingMethods.Clear();

                    
    // add the valid ones so as to continue
                    
    availableShippingMethods.AddRange(temp_validMethods);

                    
    // temporary collection has overlived it's use
                    
    temp_validMethods.Clear(); 

    Here for example purposes, i'm filtering out shipping methods that simply starts with the word "Express"

  10. #10
    shark92651 is offline Member
    Join Date
    Jan 2006
    Posts
    81

    Default

    Mark,

    Thanks, that code works perfectly. Yes I forgot changing the length of a collection during an iteration will not work - I have a hard time wrapping my head around c# coding while not in Visual Studio

    Actually, if you use an iterator class like this you can: http://www.koders.com/csharp/fidF2C8...aspx?s=textbox

    But that is not the most efficient code as it makes a copy, but that is sort of what we are doing in this case anyway.

    Thanks,
    David
    Last edited by shark92651; 11-02-2009 at 03:31 PM.