Looking for old forum posts and information? View the old forum archive here ยป
Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

A static copy of our previous forums website is available online for reference. Click here to access the forum archive.

Learn more about...

AspDotNetStorefront
DotFeed

shipping method default select

I wrote the code for the shipping method selection when page load. But when i select the shipping method, CartSummury is not updating with selected shipping method cost, the payment section is not enable mode and the place order button is hidden. I have written this below code in shipmethodselector.aspx.cs. How can i refresh the CartSummury, how can i enable the payment info and place order button section. Please advise.

 var ids = new HashSet<string>(shippingMethods.Where(x => x.Name.ToUpper()=="US MAIL" & x.Amount==0).Select(y=>y.Name));
        ShippingMethods.DataSource = shippingMethods.Where(z=>!ids.Contains(z.Name));
        ShippingMethods.DataTextField = "DisplayName";
        ShippingMethods.DataValueField = "Identifier";
        ShippingMethods.DataBind();
        int i=0;
        foreach (var item in shippingMethods)
        {
            if (item.Name.ToLower() == "us mail" && item.Amount > 0)
            {
                ShippingMethods.SelectedIndex = i;
                break;
            }
            i = i + 1;
        }
asked Aug 24, 2016 in MultiStore by chsatya (120 points)

1 Answer

0 votes
SOPC is only going to move past the shipping method step (which will enable options further down the page) when a customer chooses a shipping method, which causes a postback and runs a bunch of logic.  If you're just setting the selected index in the codebehind, all you're doing is choosing which option appears to be selected when the page loads.  As far as checkout is concerned, the customer still hasn't chosen a shipping method, there's just one pre-selected in the list.

You need to also be executing the logic that would fire on the postback when a customer chooses a shipping method, which actually sets the shipping method ID on their customer record so SOPC knows they've made a choice.

Check out the shippingmethodselector.ascx.cs ShippingMethods_SelectedIndexChanged() method.  You need to be doing all the same stuff.
answered Aug 24, 2016 by Vortx ScottS (13,500 points)
...