Page 1 of 1

PlaceOrder2.aspx - set default country in dropdownlist

Posted: Wed Jul 29, 2009 9:04 am
by niall08
How do you set the default country in the dropdown list when placing an order in the admin interface, PlaceOrder2.aspx

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 6:16 am
by niall08
Any ideas?

Can/should it be set to the default warehouse location?

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 7:23 am
by mazhar
Well in 7.0.1 it seems that we are just picking the first available country in list. As for as 7.0.3 is concerned on checkout page we first try to locate the default country from within any available user address other wise we pick the default warehouse country.

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 7:32 am
by niall08
Any suggestions about how to do it in 7.0.1?

e.g. in the Page_Load

Code: Select all

if (!Page.IsPostBack)
        {

            // INITIALIZE THE BILLING ADDRESS
            if (_Basket.User != null && !_Basket.User.IsAnonymous)
            {
                BindBillingAddress();
                BindShippingAddress();
            }
            else
            {
                CustomerLookupButton.Visible = true;
                BillToCountryCode.SelectedValue = "GB";
            }
            UpdateShipMethod();
        }

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 7:43 am
by mazhar
It could be something like below. I haven't tested it you can try it.

Code: Select all

// INITIALIZE THE BILLING ADDRESS
            if (_Basket.User != null && !_Basket.User.IsAnonymous)
            {
                BindBillingAddress();
                BindShippingAddress();
                
                ListItem defaultCountry1 = BillToCountryCode.Items.FindByValue(Token.Instance.Store.DefaultWarehouse.Country.CountryCode);
                defaultCountry1.Selected = true;

                ListItem defaultCountry2 = ShipToCountryCode.Items.FindByValue(Token.Instance.Store.DefaultWarehouse.Country.CountryCode);
                defaultCountry2.Selected = true;
            }
            else
            {
                CustomerLookupButton.Visible = true;
            }
            UpdateShipMethod();

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 8:15 am
by niall08
Thanks Mazhar - I'd seen a reference to "DefaultWarehouse" as a means of setting the default CountryCode somewhere in the code, but I couldn't remember where.

Re: PlaceOrder2.aspx - set default country in dropdownlist

Posted: Thu Jul 30, 2009 8:19 am
by mazhar
Go to OnePageCheckout code, I think you will find something similar there.